Changeset 49547
- Timestamp:
- 11/09/2020 03:43:14 PM (4 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/testcase-block-supports.php
r49545 r49547 124 124 $style_list = $this->get_attribute_from_block( 'style', $styled_block ); 125 125 126 $this->assert Equals( $expected_classes, $class_list );127 $this->assert Equals( $expected_styles, $style_list );126 $this->assertSame( $expected_classes, $class_list ); 127 $this->assertSame( $expected_styles, $style_list ); 128 128 } 129 129 … … 139 139 140 140 // Ensure blocks to not add extra whitespace. 141 $this->assert Equals( $styled_block, trim( $styled_block ) );141 $this->assertSame( $styled_block, trim( $styled_block ) ); 142 142 143 143 $content = $this->get_content_from_block( $styled_block ); … … 145 145 $style_list = $this->get_attribute_from_block( 'style', $styled_block ); 146 146 147 $this->assert Equals( self::BLOCK_CONTENT, $content );148 $this->assert EqualSets(147 $this->assertSame( self::BLOCK_CONTENT, $content ); 148 $this->assertSameSets( 149 149 explode( ' ', $expected_classes ), 150 150 explode( ' ', $class_list ) 151 151 ); 152 $this->assert Equals(152 $this->assertSame( 153 153 array_map( 'trim', explode( ';', $expected_styles ) ), 154 154 array_map( 'trim', explode( ';', $style_list ) ) -
trunk/tests/phpunit/tests/auth.php
r49109 r49547 452 452 $_SERVER['PHP_AUTH_PW'] = 'http_auth_pass'; 453 453 454 $this->assert Equals(455 0,454 $this->assertSame( 455 null, 456 456 wp_validate_application_password( null ), 457 457 'Regular user account password should not be allowed for API authentication' … … 461 461 $_SERVER['PHP_AUTH_PW'] = $user_app_password; 462 462 463 $this->assert Equals(463 $this->assertSame( 464 464 $user_id, 465 465 wp_validate_application_password( null ), … … 492 492 $error = wp_authenticate_application_password( null, 'idonotexist', 'password' ); 493 493 $this->assertWPError( $error ); 494 $this->assert Equals( 'invalid_username', $error->get_error_code() );494 $this->assertSame( 'invalid_username', $error->get_error_code() ); 495 495 } 496 496 … … 503 503 $error = wp_authenticate_application_password( null, 'idonotexist@example.org', 'password' ); 504 504 $this->assertWPError( $error ); 505 $this->assert Equals( 'invalid_email', $error->get_error_code() );505 $this->assertSame( 'invalid_email', $error->get_error_code() ); 506 506 } 507 507 … … 515 515 $error = wp_authenticate_application_password( null, self::$_user->user_login, 'password' ); 516 516 $this->assertWPError( $error ); 517 $this->assert Equals( 'application_passwords_disabled', $error->get_error_code() );517 $this->assertSame( 'application_passwords_disabled', $error->get_error_code() ); 518 518 } 519 519 … … 528 528 $error = wp_authenticate_application_password( null, self::$_user->user_login, 'password' ); 529 529 $this->assertWPError( $error ); 530 $this->assert Equals( 'application_passwords_disabled', $error->get_error_code() );530 $this->assertSame( 'application_passwords_disabled', $error->get_error_code() ); 531 531 } 532 532 … … 540 540 $error = wp_authenticate_application_password( null, self::$_user->user_login, 'password' ); 541 541 $this->assertWPError( $error ); 542 $this->assert Equals( 'incorrect_password', $error->get_error_code() );542 $this->assertSame( 'incorrect_password', $error->get_error_code() ); 543 543 } 544 544 … … 561 561 $error = wp_authenticate_application_password( null, self::$_user->user_login, $password ); 562 562 $this->assertWPError( $error ); 563 $this->assert Equals( 'my_code', $error->get_error_code() );563 $this->assertSame( 'my_code', $error->get_error_code() ); 564 564 } 565 565 … … 575 575 $user = wp_authenticate_application_password( null, self::$_user->user_login, $password ); 576 576 $this->assertInstanceOf( WP_User::class, $user ); 577 $this->assert Equals( self::$user_id, $user->ID );577 $this->assertSame( self::$user_id, $user->ID ); 578 578 } 579 579 … … 589 589 $user = wp_authenticate_application_password( null, self::$_user->user_email, $password ); 590 590 $this->assertInstanceOf( WP_User::class, $user ); 591 $this->assert Equals( self::$user_id, $user->ID );591 $this->assertSame( self::$user_id, $user->ID ); 592 592 } 593 593 … … 603 603 $user = wp_authenticate_application_password( null, self::$_user->user_email, WP_Application_Passwords::chunk_password( $password ) ); 604 604 $this->assertInstanceOf( WP_User::class, $user ); 605 $this->assert Equals( self::$user_id, $user->ID );605 $this->assertSame( self::$user_id, $user->ID ); 606 606 } 607 607 } -
trunk/tests/phpunit/tests/functions.php
r49382 r49547 1764 1764 */ 1765 1765 public function test_wp_is_json_media_type( $input, $expected ) { 1766 $this->assert Equals( $expected, wp_is_json_media_type( $input ) );1766 $this->assertSame( $expected, wp_is_json_media_type( $input ) ); 1767 1767 } 1768 1768 -
trunk/tests/phpunit/tests/multisite/site.php
r49383 r49547 503 503 restore_current_blog(); 504 504 $this->assertNotEmpty( $spam_permalink ); 505 $this->assert Equals( $post_data['post_title'], $post->post_title );505 $this->assertSame( $post_data['post_title'], $post->post_title ); 506 506 507 507 update_blog_status( $spam_blog_id, 'spam', 1 ); -
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'] ); -
trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php
r49302 r49547 1029 1029 1030 1030 $this->assertNotWPError( $response->as_error() ); 1031 $this->assert Equals( 'inherit', $response->get_data()['status'] );1031 $this->assertSame( 'inherit', $response->get_data()['status'] ); 1032 1032 } 1033 1033 -
trunk/tests/phpunit/tests/rest-api/rest-comments-controller.php
r49303 r49547 1441 1441 $response = rest_get_server()->dispatch( $request ); 1442 1442 $this->assertSame( 201, $response->get_status() ); 1443 $this->assert Equals( '0', $response->get_data()['content']['raw'] );1443 $this->assertSame( '0', $response->get_data()['content']['raw'] ); 1444 1444 } 1445 1445 … … 1466 1466 $response = rest_get_server()->dispatch( $request ); 1467 1467 $this->assertSame( 201, $response->get_status() ); 1468 $this->assert Equals( '', $response->get_data()['content']['raw'] );1468 $this->assertSame( '', $response->get_data()['content']['raw'] ); 1469 1469 } 1470 1470 … … 3326 3326 3327 3327 if ( $comment->comment_post_ID ) { 3328 $this->assert Equals( rest_url( '/wp/v2/posts/' . $comment->comment_post_ID ), $links['up'][0]['href'] );3328 $this->assertSame( rest_url( '/wp/v2/posts/' . $comment->comment_post_ID ), $links['up'][0]['href'] ); 3329 3329 } 3330 3330 -
trunk/tests/phpunit/tests/rest-api/rest-controller.php
r49246 r49547 249 249 $args = rest_get_endpoint_args_for_schema( $controller->get_item_schema() ); 250 250 251 $this->assert Equals( 'A pretty string.', $args['somestring']['description'] );251 $this->assertSame( 'A pretty string.', $args['somestring']['description'] ); 252 252 $this->assertFalse( isset( $args['someinteger']['description'] ) ); 253 253 } -
trunk/tests/phpunit/tests/rest-api/rest-request.php
r49329 r49547 206 206 207 207 // Check that JSON takes precedence. 208 $this->assert Equals( $source, $this->request->get_param( 'source' ) );208 $this->assertSame( $source, $this->request->get_param( 'source' ) ); 209 209 $this->assertEquals( $accept_json, $this->request->get_param( 'has_json_params' ) ); 210 210 } … … 234 234 235 235 // Check for JSON content-type. 236 $this->assert Equals( $is_json, $this->request->is_json_content_type() );236 $this->assertSame( $is_json, $this->request->is_json_content_type() ); 237 237 } 238 238 … … 927 927 $valid = $request->has_valid_params(); 928 928 $this->assertWPError( $valid ); 929 $this->assert Equals( 'rest_invalid_param', $valid->get_error_code() );929 $this->assertSame( 'rest_invalid_param', $valid->get_error_code() ); 930 930 } 931 931 } -
trunk/tests/phpunit/tests/rest-api/rest-search-controller.php
r49365 r49547 570 570 ) 571 571 ); 572 $this->assert Equals( 200, $response->get_status() );573 $this->assert EqualSets(572 $this->assertSame( 200, $response->get_status() ); 573 $this->assertSameSets( 574 574 array( 575 575 0 => 1, // That is the default category. … … 595 595 ); 596 596 597 $this->assert Equals( 200, $response->get_status() );598 $this->assert EqualSets(597 $this->assertSame( 200, $response->get_status() ); 598 $this->assertSameSets( 599 599 array( 600 600 0 => 1, // That is the default category. … … 635 635 ) 636 636 ); 637 $this->assert Equals( 200, $response->get_status() );638 $this->assert EqualSets(637 $this->assertSame( 200, $response->get_status() ); 638 $this->assertSameSets( 639 639 array( 640 640 0 => 1, // This is the default category. … … 660 660 ); 661 661 662 $this->assert Equals( 200, $response->get_status() );663 $this->assert EqualSets(662 $this->assertSame( 200, $response->get_status() ); 663 $this->assertSameSets( 664 664 array( 665 665 self::$my_category_id, … … 683 683 ); 684 684 685 $this->assert Equals( 200, $response->get_status() );686 $this->assert EqualSets(685 $this->assertSame( 200, $response->get_status() ); 686 $this->assertSameSets( 687 687 array( 688 688 self::$my_tag_id, … … 706 706 ); 707 707 708 $this->assert Equals( 200, $response->get_status() );708 $this->assertSame( 200, $response->get_status() ); 709 709 $this->assertEmpty( $response->get_data() ); 710 710 } … … 722 722 ) 723 723 ); 724 $this->assert Equals( 200, $response->get_status() );724 $this->assertSame( 200, $response->get_status() ); 725 725 $this->assertContains( 726 726 'Aside', … … 743 743 ); 744 744 745 $this->assert Equals( 200, $response->get_status() );745 $this->assertSame( 200, $response->get_status() ); 746 746 $this->assertContains( 747 747 'Aside', … … 765 765 ); 766 766 767 $this->assert Equals( 200, $response->get_status() );767 $this->assertSame( 200, $response->get_status() ); 768 768 $this->assertEmpty( $response->get_data() ); 769 769 } -
trunk/tests/phpunit/tests/rest-api/rest-server.php
r49257 r49547 1551 1551 $this->assertCount( 1, $events ); 1552 1552 $this->assertWPError( $events[0]['args'][0] ); 1553 $this->assert Equals( 'rest_invalid_handler', $events[0]['args'][0]->get_error_code() );1553 $this->assertSame( 'rest_invalid_handler', $events[0]['args'][0]->get_error_code() ); 1554 1554 } 1555 1555 … … 1615 1615 $this->assertCount( 1, $events ); 1616 1616 $this->assertWPError( $events[0]['args'][0] ); 1617 $this->assert Equals( 'rest_invalid_param', $events[0]['args'][0]->get_error_code() );1617 $this->assertSame( 'rest_invalid_param', $events[0]['args'][0]->get_error_code() ); 1618 1618 } 1619 1619 … … 1654 1654 $response = rest_do_request( $request ); 1655 1655 1656 $this->assert Equals( 207, $response->get_status() );1656 $this->assertSame( 207, $response->get_status() ); 1657 1657 1658 1658 if ( $allowed ) { 1659 $this->assert Equals( 'data', $response->get_data()['responses'][0]['body'] );1659 $this->assertSame( 'data', $response->get_data()['responses'][0]['body'] ); 1660 1660 } else { 1661 $this->assert Equals( 'rest_batch_not_allowed', $response->get_data()['responses'][0]['body']['code'] );1661 $this->assertSame( 'rest_batch_not_allowed', $response->get_data()['responses'][0]['body']['code'] ); 1662 1662 } 1663 1663 } … … 1724 1724 $data = $response->get_data(); 1725 1725 1726 $this->assert Equals( 207, $response->get_status() );1726 $this->assertSame( 207, $response->get_status() ); 1727 1727 $this->assertArrayHasKey( 'failed', $data ); 1728 $this->assert Equals( 'validation', $data['failed'] );1728 $this->assertSame( 'validation', $data['failed'] ); 1729 1729 $this->assertCount( 2, $data['responses'] ); 1730 1730 $this->assertNull( $data['responses'][0] ); 1731 $this->assert Equals( 400, $data['responses'][1]['status'] );1731 $this->assertSame( 400, $data['responses'][1]['status'] ); 1732 1732 $this->assertFalse( get_option( 'test_project' ) ); 1733 1733 } … … 1780 1780 $data = $response->get_data(); 1781 1781 1782 $this->assert Equals( 207, $response->get_status() );1782 $this->assertSame( 207, $response->get_status() ); 1783 1783 $this->assertArrayNotHasKey( 'failed', $data ); 1784 1784 $this->assertCount( 2, $data['responses'] ); 1785 $this->assert Equals( 'gutenberg', $data['responses'][0]['body'] );1786 $this->assert Equals( 'WordPress', $data['responses'][1]['body'] );1785 $this->assertSame( 'gutenberg', $data['responses'][0]['body'] ); 1786 $this->assertSame( 'WordPress', $data['responses'][1]['body'] ); 1787 1787 } 1788 1788 … … 1797 1797 'methods' => array( 'POST', 'DELETE' ), 1798 1798 'callback' => function ( WP_REST_Request $request ) { 1799 $this->assert Equals( 'DELETE', $request->get_method() );1800 $this->assert Equals( '/test-ns/v1/test/5', $request->get_route() );1801 $this->assert Equals( array( 'id' => '5' ), $request->get_url_params() );1802 $this->assert Equals( array( 'query' => 'param' ), $request->get_query_params() );1803 $this->assert Equals( array( 'project' => 'gutenberg' ), $request->get_body_params() );1804 $this->assert Equals( array( 'my_header' => array( 'my-value' ) ), $request->get_headers() );1799 $this->assertSame( 'DELETE', $request->get_method() ); 1800 $this->assertSame( '/test-ns/v1/test/5', $request->get_route() ); 1801 $this->assertSame( array( 'id' => '5' ), $request->get_url_params() ); 1802 $this->assertSame( array( 'query' => 'param' ), $request->get_query_params() ); 1803 $this->assertSame( array( 'project' => 'gutenberg' ), $request->get_body_params() ); 1804 $this->assertSame( array( 'my_header' => array( 'my-value' ) ), $request->get_headers() ); 1805 1805 1806 1806 return new WP_REST_Response( 'test' ); … … 1831 1831 $response = rest_get_server()->dispatch( $request ); 1832 1832 1833 $this->assert Equals( 207, $response->get_status() );1834 $this->assert Equals( 'test', $response->get_data()['responses'][0]['body'] );1833 $this->assertSame( 207, $response->get_status() ); 1834 $this->assertSame( 'test', $response->get_data()['responses'][0]['body'] ); 1835 1835 } 1836 1836 … … 1884 1884 $data = $response->get_data(); 1885 1885 1886 $this->assert Equals( 207, $response->get_status() );1886 $this->assertSame( 207, $response->get_status() ); 1887 1887 $this->assertArrayNotHasKey( 'failed', $data ); 1888 1888 $this->assertCount( 2, $data['responses'] ); 1889 $this->assert Equals( 'gutenberg', $data['responses'][0]['body'] );1890 $this->assert Equals( 400, $data['responses'][1]['status'] );1891 $this->assert Equals( 'gutenberg', get_option( 'test_project' ) );1889 $this->assertSame( 'gutenberg', $data['responses'][0]['body'] ); 1890 $this->assertSame( 400, $data['responses'][1]['status'] ); 1891 $this->assertSame( 'gutenberg', get_option( 'test_project' ) ); 1892 1892 } 1893 1893 … … 1929 1929 1930 1930 $response = rest_get_server()->dispatch( $request ); 1931 $this->assert Equals( 400, $response->get_status() );1931 $this->assertSame( 400, $response->get_status() ); 1932 1932 } 1933 1933 -
trunk/tests/phpunit/tests/rest-api/rest-site-health-controller.php
r49156 r49547 98 98 wp_set_current_user( self::$admin ); 99 99 $response = rest_do_request( '/wp-site-health/v1/tests/dotorg-communication' ); 100 $this->assert Equals( 'dotorg_communication', $response->get_data()['test'] );100 $this->assertSame( 'dotorg_communication', $response->get_data()['test'] ); 101 101 } 102 102 }
Note: See TracChangeset
for help on using the changeset viewer.