- Timestamp:
- 11/09/2020 03:43:14 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-application-passwords-controller.php
r49276 r49547 135 135 136 136 $response = rest_do_request( '/wp/v2/users/me/application-passwords' ); 137 $this->assert Equals( 200, $response->get_status() );137 $this->assertSame( 200, $response->get_status() ); 138 138 $this->assertCount( 1, $response->get_data() ); 139 139 $this->check_response( $response->get_data()[0], $item ); … … 148 148 149 149 $response = rest_do_request( sprintf( '/wp/v2/users/%d/application-passwords', self::$admin ) ); 150 $this->assert Equals( 200, $response->get_status() );150 $this->assertSame( 200, $response->get_status() ); 151 151 $this->assertCount( 1, $response->get_data() ); 152 152 $this->check_response( $response->get_data()[0], $item ); … … 161 161 162 162 $response = rest_do_request( sprintf( '/wp/v2/users/%d/application-passwords', self::$subscriber_id ) ); 163 $this->assert Equals( 200, $response->get_status() );163 $this->assertSame( 200, $response->get_status() ); 164 164 $this->assertCount( 1, $response->get_data() ); 165 165 $this->check_response( $response->get_data()[0], $item ); … … 174 174 175 175 $response = rest_do_request( sprintf( '/wp/v2/users/%d/application-passwords', self::$subscriber_id ) ); 176 $this->assert Equals( 200, $response->get_status() );176 $this->assertSame( 200, $response->get_status() ); 177 177 $this->assertCount( 1, $response->get_data() ); 178 178 $this->check_response( $response->get_data()[0], $item ); … … 216 216 $uuid = $item['uuid']; 217 217 $response = rest_do_request( '/wp/v2/users/me/application-passwords/' . $uuid ); 218 $this->assert Equals( 200, $response->get_status() );218 $this->assertSame( 200, $response->get_status() ); 219 219 $this->check_response( $response->get_data(), $item ); 220 220 } … … 229 229 $uuid = $item['uuid']; 230 230 $response = rest_do_request( sprintf( '/wp/v2/users/%d/application-passwords/%s', self::$admin, $uuid ) ); 231 $this->assert Equals( 200, $response->get_status() );231 $this->assertSame( 200, $response->get_status() ); 232 232 $this->check_response( $response->get_data(), $item ); 233 233 } … … 242 242 $uuid = $item['uuid']; 243 243 $response = rest_do_request( sprintf( '/wp/v2/users/%d/application-passwords/%s', self::$subscriber_id, $uuid ) ); 244 $this->assert Equals( 200, $response->get_status() );244 $this->assertSame( 200, $response->get_status() ); 245 245 $this->check_response( $response->get_data(), $item ); 246 246 } … … 255 255 $uuid = $item['uuid']; 256 256 $response = rest_do_request( sprintf( '/wp/v2/users/%d/application-passwords/%s', self::$subscriber_id, $uuid ) ); 257 $this->assert Equals( 200, $response->get_status() );257 $this->assertSame( 200, $response->get_status() ); 258 258 $this->check_response( $response->get_data(), $item ); 259 259 } … … 319 319 $response = rest_do_request( $request ); 320 320 321 $this->assert Equals( 201, $response->get_status() );321 $this->assertSame( 201, $response->get_status() ); 322 322 323 323 $passwords = WP_Application_Passwords::get_user_application_passwords( self::$admin ); 324 324 $this->assertCount( 1, $passwords ); 325 325 $this->check_response( $response->get_data(), $passwords[0], true ); 326 $this->assert Equals( 'App', $response->get_data()['name'] );327 $this->assert Equals( $app_id, $response->get_data()['app_id'] );326 $this->assertSame( 'App', $response->get_data()['name'] ); 327 $this->assertSame( $app_id, $response->get_data()['app_id'] ); 328 328 $this->assertNull( $response->get_data()['last_used'] ); 329 329 $this->assertNull( $response->get_data()['last_ip'] ); … … 340 340 $response = rest_do_request( $request ); 341 341 342 $this->assert Equals( 201, $response->get_status() );342 $this->assertSame( 201, $response->get_status() ); 343 343 344 344 $passwords = WP_Application_Passwords::get_user_application_passwords( self::$admin ); … … 357 357 $response = rest_do_request( $request ); 358 358 359 $this->assert Equals( 201, $response->get_status() );359 $this->assertSame( 201, $response->get_status() ); 360 360 361 361 $passwords = WP_Application_Passwords::get_user_application_passwords( self::$subscriber_id ); … … 374 374 $response = rest_do_request( $request ); 375 375 376 $this->assert Equals( 201, $response->get_status() );376 $this->assertSame( 201, $response->get_status() ); 377 377 378 378 $passwords = WP_Application_Passwords::get_user_application_passwords( self::$subscriber_id ); … … 416 416 $request->set_body_params( array( 'name' => 'New App' ) ); 417 417 $response = rest_do_request( $request ); 418 $this->assert Equals( 200, $response->get_status() );418 $this->assertSame( 200, $response->get_status() ); 419 419 $this->check_response( $response->get_data(), WP_Application_Passwords::get_user_application_password( self::$admin, $item['uuid'] ) ); 420 $this->assert Equals( 'New App', $response->get_data()['name'] );420 $this->assertSame( 'New App', $response->get_data()['name'] ); 421 421 } 422 422 … … 432 432 $request->set_body_params( array( 'name' => 'New App' ) ); 433 433 $response = rest_do_request( $request ); 434 $this->assert Equals( 200, $response->get_status() );434 $this->assertSame( 200, $response->get_status() ); 435 435 $this->check_response( $response->get_data(), WP_Application_Passwords::get_user_application_password( self::$admin, $item['uuid'] ) ); 436 $this->assert Equals( 'New App', $response->get_data()['name'] );436 $this->assertSame( 'New App', $response->get_data()['name'] ); 437 437 } 438 438 … … 448 448 $request->set_body_params( array( 'name' => 'New App' ) ); 449 449 $response = rest_do_request( $request ); 450 $this->assert Equals( 200, $response->get_status() );450 $this->assertSame( 200, $response->get_status() ); 451 451 $this->check_response( $response->get_data(), WP_Application_Passwords::get_user_application_password( self::$subscriber_id, $item['uuid'] ) ); 452 $this->assert Equals( 'New App', $response->get_data()['name'] );452 $this->assertSame( 'New App', $response->get_data()['name'] ); 453 453 } 454 454 … … 464 464 $request->set_body_params( array( 'name' => 'New App' ) ); 465 465 $response = rest_do_request( $request ); 466 $this->assert Equals( 200, $response->get_status() );466 $this->assertSame( 200, $response->get_status() ); 467 467 $this->check_response( $response->get_data(), WP_Application_Passwords::get_user_application_password( self::$subscriber_id, $item['uuid'] ) ); 468 $this->assert Equals( 'New App', $response->get_data()['name'] );468 $this->assertSame( 'New App', $response->get_data()['name'] ); 469 469 } 470 470 … … 532 532 $request->set_body_params( array( 'app_id' => wp_generate_uuid4() ) ); 533 533 $response = rest_do_request( $request ); 534 $this->assert Equals( '', $response->get_data()['app_id'] );534 $this->assertSame( '', $response->get_data()['app_id'] ); 535 535 536 536 $app_id = wp_generate_uuid4(); … … 548 548 $request->set_body_params( array( 'app_id' => wp_generate_uuid4() ) ); 549 549 $response = rest_do_request( $request ); 550 $this->assert Equals( $app_id, $response->get_data()['app_id'] );550 $this->assertSame( $app_id, $response->get_data()['app_id'] ); 551 551 } 552 552 … … 561 561 $request = new WP_REST_Request( 'DELETE', '/wp/v2/users/me/application-passwords/' . $uuid ); 562 562 $response = rest_do_request( $request ); 563 $this->assert Equals( 200, $response->get_status() );563 $this->assertSame( 200, $response->get_status() ); 564 564 $this->assertArrayHasKey( 'deleted', $response->get_data() ); 565 565 $this->assertTrue( $response->get_data()['deleted'] ); … … 580 580 $request = new WP_REST_Request( 'DELETE', sprintf( '/wp/v2/users/%d/application-passwords/%s', self::$admin, $uuid ) ); 581 581 $response = rest_do_request( $request ); 582 $this->assert Equals( 200, $response->get_status() );582 $this->assertSame( 200, $response->get_status() ); 583 583 $this->check_response( $response->get_data()['previous'], $item ); 584 584 } … … 594 594 $request = new WP_REST_Request( 'DELETE', sprintf( '/wp/v2/users/%d/application-passwords/%s', self::$subscriber_id, $uuid ) ); 595 595 $response = rest_do_request( $request ); 596 $this->assert Equals( 200, $response->get_status() );596 $this->assertSame( 200, $response->get_status() ); 597 597 $this->check_response( $response->get_data()['previous'], $item ); 598 598 } … … 608 608 $request = new WP_REST_Request( 'DELETE', sprintf( '/wp/v2/users/%d/application-passwords/%s', self::$subscriber_id, $uuid ) ); 609 609 $response = rest_do_request( $request ); 610 $this->assert Equals( 200, $response->get_status() );610 $this->assertSame( 200, $response->get_status() ); 611 611 $this->check_response( $response->get_data()['previous'], $item ); 612 612 } … … 670 670 $request = new WP_REST_Request( 'DELETE', '/wp/v2/users/me/application-passwords' ); 671 671 $response = rest_do_request( $request ); 672 $this->assert Equals( 200, $response->get_status() );672 $this->assertSame( 200, $response->get_status() ); 673 673 $this->assertArrayHasKey( 'deleted', $response->get_data() ); 674 674 $this->assertTrue( $response->get_data()['deleted'] ); 675 675 $this->assertArrayHasKey( 'count', $response->get_data() ); 676 $this->assert Equals( 2, $response->get_data()['count'] );676 $this->assertSame( 2, $response->get_data()['count'] ); 677 677 678 678 $this->assertCount( 0, WP_Application_Passwords::get_user_application_passwords( self::$admin ) ); … … 688 688 $request = new WP_REST_Request( 'DELETE', sprintf( '/wp/v2/users/%d/application-passwords', self::$admin ) ); 689 689 $response = rest_do_request( $request ); 690 $this->assert Equals( 200, $response->get_status() );690 $this->assertSame( 200, $response->get_status() ); 691 691 $this->assertCount( 0, WP_Application_Passwords::get_user_application_passwords( self::$admin ) ); 692 692 } … … 701 701 $request = new WP_REST_Request( 'DELETE', sprintf( '/wp/v2/users/%d/application-passwords', self::$subscriber_id ) ); 702 702 $response = rest_do_request( $request ); 703 $this->assert Equals( 200, $response->get_status() );703 $this->assertSame( 200, $response->get_status() ); 704 704 $this->assertCount( 0, WP_Application_Passwords::get_user_application_passwords( self::$admin ) ); 705 705 } … … 714 714 $request = new WP_REST_Request( 'DELETE', sprintf( '/wp/v2/users/%d/application-passwords', self::$subscriber_id ) ); 715 715 $response = rest_do_request( $request ); 716 $this->assert Equals( 200, $response->get_status() );716 $this->assertSame( 200, $response->get_status() ); 717 717 $this->assertCount( 0, WP_Application_Passwords::get_user_application_passwords( self::$admin ) ); 718 718 } … … 819 819 $this->assertArrayHasKey( 'last_ip', $response ); 820 820 821 $this->assert Equals( $item['uuid'], $response['uuid'] );822 $this->assert Equals( $item['app_id'], $response['app_id'] );823 $this->assert Equals( $item['name'], $response['name'] );824 $this->assert Equals( gmdate( 'Y-m-d\TH:i:s', $item['created'] ), $response['created'] );821 $this->assertSame( $item['uuid'], $response['uuid'] ); 822 $this->assertSame( $item['app_id'], $response['app_id'] ); 823 $this->assertSame( $item['name'], $response['name'] ); 824 $this->assertSame( gmdate( 'Y-m-d\TH:i:s', $item['created'] ), $response['created'] ); 825 825 826 826 if ( $item['last_used'] ) { 827 $this->assert Equals( gmdate( 'Y-m-d\TH:i:s', $item['last_used'] ), $response['last_used'] );827 $this->assertSame( gmdate( 'Y-m-d\TH:i:s', $item['last_used'] ), $response['last_used'] ); 828 828 } else { 829 829 $this->assertNull( $response['last_used'] ); … … 831 831 832 832 if ( $item['last_ip'] ) { 833 $this->assert Equals( $item['last_ip'], $response['last_ip'] );833 $this->assertSame( $item['last_ip'], $response['last_ip'] ); 834 834 } else { 835 835 $this->assertNull( $response['last_ip'] );
Note: See TracChangeset
for help on using the changeset viewer.