- Timestamp:
- 09/02/2020 12:35:36 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-tags-controller.php
r47122 r48937 136 136 $response = rest_get_server()->dispatch( $request ); 137 137 $data = $response->get_data(); 138 $this->assert Equals( 'view', $data['endpoints'][0]['args']['context']['default'] );138 $this->assertSame( 'view', $data['endpoints'][0]['args']['context']['default'] ); 139 139 $this->assertEqualSets( array( 'view', 'embed', 'edit' ), $data['endpoints'][0]['args']['context']['enum'] ); 140 140 // Single. … … 143 143 $response = rest_get_server()->dispatch( $request ); 144 144 $data = $response->get_data(); 145 $this->assert Equals( 'view', $data['endpoints'][0]['args']['context']['default'] );145 $this->assertSame( 'view', $data['endpoints'][0]['args']['context']['default'] ); 146 146 $this->assertEqualSets( array( 'view', 'embed', 'edit' ), $data['endpoints'][0]['args']['context']['enum'] ); 147 147 } … … 153 153 $keys = array_keys( $data['endpoints'][0]['args'] ); 154 154 sort( $keys ); 155 $this->assert Equals(155 $this->assertSame( 156 156 array( 157 157 'context', … … 201 201 $response = rest_get_server()->dispatch( $request ); 202 202 $data = $response->get_data(); 203 $this->assert Equals( 2, count( $data ) );204 $this->assert Equals( 'Season 5', $data[0]['name'] );205 $this->assert Equals( 'The Be Sharps', $data[1]['name'] );203 $this->assertSame( 2, count( $data ) ); 204 $this->assertSame( 'Season 5', $data[0]['name'] ); 205 $this->assertSame( 'The Be Sharps', $data[1]['name'] ); 206 206 207 207 // Invalid 'hide_empty' should error. … … 221 221 $response = rest_get_server()->dispatch( $request ); 222 222 $data = $response->get_data(); 223 $this->assert Equals( 2, count( $data ) );224 $this->assert Equals( $id1, $data[0]['id'] );223 $this->assertSame( 2, count( $data ) ); 224 $this->assertSame( $id1, $data[0]['id'] ); 225 225 226 226 // 'orderby' => 'include'. … … 228 228 $response = rest_get_server()->dispatch( $request ); 229 229 $data = $response->get_data(); 230 $this->assert Equals( 2, count( $data ) );231 $this->assert Equals( $id2, $data[0]['id'] );230 $this->assertSame( 2, count( $data ) ); 231 $this->assertSame( $id2, $data[0]['id'] ); 232 232 233 233 // Invalid 'include' should error. … … 301 301 $request->set_param( 'per_page', 1 ); 302 302 $response = rest_get_server()->dispatch( $request ); 303 $this->assert Equals( 200, $response->get_status() );304 $data = $response->get_data(); 305 $this->assert Equals( 1, count( $data ) );306 $this->assert Equals( 'Zucchini', $data[0]['name'] );303 $this->assertSame( 200, $response->get_status() ); 304 $data = $response->get_data(); 305 $this->assertSame( 1, count( $data ) ); 306 $this->assertSame( 'Zucchini', $data[0]['name'] ); 307 307 308 308 $request = new WP_REST_Request( 'GET', '/wp/v2/tags' ); … … 311 311 $request->set_param( 'per_page', 2 ); 312 312 $response = rest_get_server()->dispatch( $request ); 313 $this->assert Equals( 200, $response->get_status() );314 $data = $response->get_data(); 315 $this->assert Equals( 2, count( $data ) );316 $this->assert Equals( 'Apple', $data[0]['name'] );313 $this->assertSame( 200, $response->get_status() ); 314 $data = $response->get_data(); 315 $this->assertSame( 2, count( $data ) ); 316 $this->assertSame( 'Apple', $data[0]['name'] ); 317 317 318 318 // Invalid 'orderby' should error. … … 330 330 $request = new WP_REST_Request( 'GET', '/wp/v2/tags' ); 331 331 $response = rest_get_server()->dispatch( $request ); 332 $this->assert Equals( 200, $response->get_status() );333 $data = $response->get_data(); 334 $this->assert Equals( 'Apple', $data[0]['name'] );335 $this->assert Equals( 'Banana', $data[1]['name'] );336 $this->assert Equals( 'Cantaloupe', $data[2]['name'] );332 $this->assertSame( 200, $response->get_status() ); 333 $data = $response->get_data(); 334 $this->assertSame( 'Apple', $data[0]['name'] ); 335 $this->assertSame( 'Banana', $data[1]['name'] ); 336 $this->assertSame( 'Cantaloupe', $data[2]['name'] ); 337 337 338 338 // 'orderby' => 'id', with default 'order' => 'asc'. … … 340 340 $request->set_param( 'orderby', 'id' ); 341 341 $response = rest_get_server()->dispatch( $request ); 342 $this->assert Equals( 200, $response->get_status() );343 $data = $response->get_data(); 344 $this->assert Equals( 'Tag 0', $data[0]['name'] );345 $this->assert Equals( 'Tag 1', $data[1]['name'] );346 $this->assert Equals( 'Tag 2', $data[2]['name'] );342 $this->assertSame( 200, $response->get_status() ); 343 $data = $response->get_data(); 344 $this->assertSame( 'Tag 0', $data[0]['name'] ); 345 $this->assertSame( 'Tag 1', $data[1]['name'] ); 346 $this->assertSame( 'Tag 2', $data[2]['name'] ); 347 347 348 348 // 'orderby' => 'id', 'order' => 'desc'. … … 352 352 $response = rest_get_server()->dispatch( $request ); 353 353 $data = $response->get_data(); 354 $this->assert Equals( 200, $response->get_status() );355 $this->assert Equals( 'Banana', $data[0]['name'] );356 $this->assert Equals( 'Apple', $data[1]['name'] );357 $this->assert Equals( 'Cantaloupe', $data[2]['name'] );354 $this->assertSame( 200, $response->get_status() ); 355 $this->assertSame( 'Banana', $data[0]['name'] ); 356 $this->assertSame( 'Apple', $data[1]['name'] ); 357 $this->assertSame( 'Cantaloupe', $data[2]['name'] ); 358 358 } 359 359 … … 368 368 $response = rest_get_server()->dispatch( $request ); 369 369 $data = $response->get_data(); 370 $this->assert Equals( 200, $response->get_status() );371 $this->assert Equals( 'taco', $data[0]['slug'] );372 $this->assert Equals( 'burrito', $data[1]['slug'] );373 $this->assert Equals( 'chalupa', $data[2]['slug'] );370 $this->assertSame( 200, $response->get_status() ); 371 $this->assertSame( 'taco', $data[0]['slug'] ); 372 $this->assertSame( 'burrito', $data[1]['slug'] ); 373 $this->assertSame( 'chalupa', $data[2]['slug'] ); 374 374 } 375 375 … … 385 385 $request->set_param( 'post', $post_id ); 386 386 $response = rest_get_server()->dispatch( $request ); 387 $this->assert Equals( 200, $response->get_status() );388 389 $data = $response->get_data(); 390 $this->assert Equals( 2, count( $data ) );391 $this->assert Equals( 'DC', $data[0]['name'] );387 $this->assertSame( 200, $response->get_status() ); 388 389 $data = $response->get_data(); 390 $this->assertSame( 2, count( $data ) ); 391 $this->assertSame( 'DC', $data[0]['name'] ); 392 392 393 393 // Invalid 'post' should error. … … 413 413 $i = 0; 414 414 foreach ( $tags as $tag ) { 415 $this->assert Equals( $tag['name'], "Tag {$i}" );415 $this->assertSame( $tag['name'], "Tag {$i}" ); 416 416 $i++; 417 417 } … … 426 426 427 427 foreach ( $tags as $tag ) { 428 $this->assert Equals( $tag['name'], "Tag {$i}" );428 $this->assertSame( $tag['name'], "Tag {$i}" ); 429 429 $i++; 430 430 } … … 437 437 $request->set_param( 'post', $post_id ); 438 438 $response = rest_get_server()->dispatch( $request ); 439 $this->assert Equals( 200, $response->get_status() );439 $this->assertSame( 200, $response->get_status() ); 440 440 441 441 $data = $response->get_data(); … … 472 472 $request->set_param( 'post', $post_id ); 473 473 $response = rest_get_server()->dispatch( $request ); 474 $this->assert Equals( 200, $response->get_status() );475 476 $data = $response->get_data(); 477 $this->assert Equals( 2, count( $data ) );478 $this->assert Equals( 'Cape', $data[0]['name'] );474 $this->assertSame( 200, $response->get_status() ); 475 476 $data = $response->get_data(); 477 $this->assertSame( 2, count( $data ) ); 478 $this->assertSame( 'Cape', $data[0]['name'] ); 479 479 } 480 480 … … 490 490 $request->set_param( 'search', 'App' ); 491 491 $response = rest_get_server()->dispatch( $request ); 492 $this->assert Equals( 200, $response->get_status() );493 $data = $response->get_data(); 494 $this->assert Equals( 1, count( $data ) );495 $this->assert Equals( 'Apple', $data[0]['name'] );492 $this->assertSame( 200, $response->get_status() ); 493 $data = $response->get_data(); 494 $this->assertSame( 1, count( $data ) ); 495 $this->assertSame( 'Apple', $data[0]['name'] ); 496 496 497 497 $request = new WP_REST_Request( 'GET', '/wp/v2/tags' ); 498 498 $request->set_param( 'search', 'Garbage' ); 499 499 $response = rest_get_server()->dispatch( $request ); 500 $this->assert Equals( 200, $response->get_status() );501 $data = $response->get_data(); 502 $this->assert Equals( 0, count( $data ) );500 $this->assertSame( 200, $response->get_status() ); 501 $data = $response->get_data(); 502 $this->assertSame( 0, count( $data ) ); 503 503 } 504 504 … … 510 510 $request->set_param( 'slug', 'apple' ); 511 511 $response = rest_get_server()->dispatch( $request ); 512 $this->assert Equals( 200, $response->get_status() );513 $data = $response->get_data(); 514 $this->assert Equals( 1, count( $data ) );515 $this->assert Equals( 'Apple', $data[0]['name'] );512 $this->assertSame( 200, $response->get_status() ); 513 $data = $response->get_data(); 514 $this->assertSame( 1, count( $data ) ); 515 $this->assertSame( 'Apple', $data[0]['name'] ); 516 516 } 517 517 … … 532 532 ); 533 533 $response = rest_get_server()->dispatch( $request ); 534 $this->assert Equals( 200, $response->get_status() );534 $this->assertSame( 200, $response->get_status() ); 535 535 $data = $response->get_data(); 536 536 $names = wp_list_pluck( $data, 'name' ); 537 537 sort( $names ); 538 $this->assert Equals( array( 'Burrito', 'Enchilada', 'Taco' ), $names );538 $this->assertSame( array( 'Burrito', 'Enchilada', 'Taco' ), $names ); 539 539 } 540 540 … … 548 548 $request->set_param( 'slug', 'taco,burrito, enchilada' ); 549 549 $response = rest_get_server()->dispatch( $request ); 550 $this->assert Equals( 200, $response->get_status() );550 $this->assertSame( 200, $response->get_status() ); 551 551 $data = $response->get_data(); 552 552 $names = wp_list_pluck( $data, 'name' ); 553 553 sort( $names ); 554 $this->assert Equals( array( 'Burrito', 'Enchilada', 'Taco' ), $names );554 $this->assertSame( array( 'Burrito', 'Enchilada', 'Taco' ), $names ); 555 555 } 556 556 … … 583 583 $response = rest_get_server()->dispatch( $request ); 584 584 $headers = $response->get_headers(); 585 $this->assert Equals( $total_tags, $headers['X-WP-Total'] );586 $this->assert Equals( $total_pages, $headers['X-WP-TotalPages'] );585 $this->assertSame( $total_tags, $headers['X-WP-Total'] ); 586 $this->assertSame( $total_pages, $headers['X-WP-TotalPages'] ); 587 587 $next_link = add_query_arg( 588 588 array( … … 602 602 $response = rest_get_server()->dispatch( $request ); 603 603 $headers = $response->get_headers(); 604 $this->assert Equals( $total_tags, $headers['X-WP-Total'] );605 $this->assert Equals( $total_pages, $headers['X-WP-TotalPages'] );604 $this->assertSame( $total_tags, $headers['X-WP-Total'] ); 605 $this->assertSame( $total_pages, $headers['X-WP-TotalPages'] ); 606 606 $prev_link = add_query_arg( 607 607 array( … … 624 624 $response = rest_get_server()->dispatch( $request ); 625 625 $headers = $response->get_headers(); 626 $this->assert Equals( $total_tags, $headers['X-WP-Total'] );627 $this->assert Equals( $total_pages, $headers['X-WP-TotalPages'] );626 $this->assertSame( $total_tags, $headers['X-WP-Total'] ); 627 $this->assertSame( $total_pages, $headers['X-WP-TotalPages'] ); 628 628 $prev_link = add_query_arg( 629 629 array( … … 640 640 $response = rest_get_server()->dispatch( $request ); 641 641 $headers = $response->get_headers(); 642 $this->assert Equals( $total_tags, $headers['X-WP-Total'] );643 $this->assert Equals( $total_pages, $headers['X-WP-TotalPages'] );642 $this->assertSame( $total_tags, $headers['X-WP-Total'] ); 643 $this->assertSame( $total_pages, $headers['X-WP-TotalPages'] ); 644 644 $prev_link = add_query_arg( 645 645 array( … … 757 757 $request->set_param( 'slug', 'so-awesome' ); 758 758 $response = rest_get_server()->dispatch( $request ); 759 $this->assert Equals( 201, $response->get_status() );759 $this->assertSame( 201, $response->get_status() ); 760 760 $headers = $response->get_headers(); 761 761 $data = $response->get_data(); 762 762 $this->assertContains( '/wp/v2/tags/' . $data['id'], $headers['Location'] ); 763 $this->assert Equals( 'My Awesome Term', $data['name'] );764 $this->assert Equals( 'This term is so awesome.', $data['description'] );765 $this->assert Equals( 'so-awesome', $data['slug'] );763 $this->assertSame( 'My Awesome Term', $data['name'] ); 764 $this->assertSame( 'This term is so awesome.', $data['description'] ); 765 $this->assertSame( 'so-awesome', $data['slug'] ); 766 766 } 767 767 … … 774 774 $request->set_param( 'slug', 'so-awesome' ); 775 775 $response = rest_get_server()->dispatch( $request ); 776 $this->assert Equals( 201, $response->get_status() );776 $this->assertSame( 201, $response->get_status() ); 777 777 $headers = $response->get_headers(); 778 778 $data = $response->get_data(); 779 779 $this->assertContains( '/wp/v2/tags/' . $data['id'], $headers['Location'] ); 780 $this->assert Equals( 'My Awesome Term', $data['name'] );781 $this->assert Equals( 'This term is so awesome.', $data['description'] );782 $this->assert Equals( 'so-awesome', $data['slug'] );780 $this->assertSame( 'My Awesome Term', $data['name'] ); 781 $this->assertSame( 'This term is so awesome.', $data['description'] ); 782 $this->assertSame( 'so-awesome', $data['slug'] ); 783 783 } 784 784 … … 817 817 $request->set_param( 'meta', array( 'test_tag_single' => 'hello' ) ); 818 818 $response = rest_get_server()->dispatch( $request ); 819 $this->assert Equals( 201, $response->get_status() );819 $this->assertSame( 201, $response->get_status() ); 820 820 $headers = $response->get_headers(); 821 821 $data = $response->get_data(); 822 822 $this->assertContains( '/wp/v2/tags/' . $data['id'], $headers['Location'] ); 823 $this->assert Equals( 'My Awesome Term', $data['name'] );824 $this->assert Equals( 'hello', get_term_meta( $data['id'], 'test_tag_single', true ) );823 $this->assertSame( 'My Awesome Term', $data['name'] ); 824 $this->assertSame( 'hello', get_term_meta( $data['id'], 'test_tag_single', true ) ); 825 825 } 826 826 … … 835 835 $request->set_param( 'id', $existing_tag_id ); 836 836 $response = rest_get_server()->dispatch( $request ); 837 $this->assert Equals( 201, $response->get_status() );837 $this->assertSame( 201, $response->get_status() ); 838 838 $headers = $response->get_headers(); 839 839 $data = $response->get_data(); 840 840 $this->assertContains( '/wp/v2/tags/' . $data['id'], $headers['Location'] ); 841 $this->assert Equals( 'My Awesome Term', $data['name'] );842 $this->assert Equals( '', get_term_meta( $existing_tag_id, 'test_tag_single', true ) );843 $this->assert Equals( 'hello', get_term_meta( $data['id'], 'test_tag_single', true ) );841 $this->assertSame( 'My Awesome Term', $data['name'] ); 842 $this->assertSame( '', get_term_meta( $existing_tag_id, 'test_tag_single', true ) ); 843 $this->assertSame( 'hello', get_term_meta( $data['id'], 'test_tag_single', true ) ); 844 844 } 845 845 … … 868 868 ); 869 869 $response = rest_get_server()->dispatch( $request ); 870 $this->assert Equals( 200, $response->get_status() );871 $data = $response->get_data(); 872 $this->assert Equals( 'New Name', $data['name'] );873 $this->assert Equals( 'New Description', $data['description'] );874 $this->assert Equals( 'new-slug', $data['slug'] );875 $this->assert Equals( 'just meta', $data['meta']['test_single'] );876 $this->assert Equals( 'tag-specific meta', $data['meta']['test_tag_single'] );870 $this->assertSame( 200, $response->get_status() ); 871 $data = $response->get_data(); 872 $this->assertSame( 'New Name', $data['name'] ); 873 $this->assertSame( 'New Description', $data['description'] ); 874 $this->assertSame( 'new-slug', $data['slug'] ); 875 $this->assertSame( 'just meta', $data['meta']['test_single'] ); 876 $this->assertSame( 'tag-specific meta', $data['meta']['test_tag_single'] ); 877 877 $this->assertFalse( isset( $data['meta']['test_cat_meta'] ) ); 878 878 } … … 885 885 $request = new WP_REST_Request( 'PUT', '/wp/v2/tags/' . $term->term_id ); 886 886 $response = rest_get_server()->dispatch( $request ); 887 $this->assert Equals( 200, $response->get_status() );887 $this->assertSame( 200, $response->get_status() ); 888 888 $request->set_param( 'slug', $term->slug ); 889 889 … … 891 891 // even if no DB rows are updated. 892 892 $response = rest_get_server()->dispatch( $request ); 893 $this->assert Equals( 200, $response->get_status() );894 895 $response = rest_get_server()->dispatch( $request ); 896 $this->assert Equals( 200, $response->get_status() );893 $this->assertSame( 200, $response->get_status() ); 894 895 $response = rest_get_server()->dispatch( $request ); 896 $this->assertSame( 200, $response->get_status() ); 897 897 } 898 898 … … 932 932 remove_filter( 'user_has_cap', array( $this, 'grant_edit_term' ), 10, 2 ); 933 933 934 $this->assert Equals( 200, $response->get_status() );935 $data = $response->get_data(); 936 $this->assert Equals( 'New Name', $data['name'] );934 $this->assertSame( 200, $response->get_status() ); 935 $data = $response->get_data(); 936 $this->assertSame( 'New Name', $data['name'] ); 937 937 } 938 938 … … 987 987 } 988 988 $response = rest_get_server()->dispatch( $request ); 989 $this->assert Equals( 201, $response->get_status() );989 $this->assertSame( 201, $response->get_status() ); 990 990 $actual_output = $response->get_data(); 991 991 992 992 // Compare expected API output to actual API output. 993 $this->assert Equals( $expected_output['name'], $actual_output['name'] );994 $this->assert Equals( $expected_output['description'], $actual_output['description'] );993 $this->assertSame( $expected_output['name'], $actual_output['name'] ); 994 $this->assertSame( $expected_output['description'], $actual_output['description'] ); 995 995 996 996 // Compare expected API output to WP internal values. 997 997 $tag = get_term_by( 'id', $actual_output['id'], 'post_tag' ); 998 $this->assert Equals( $expected_output['name'], $tag->name );999 $this->assert Equals( $expected_output['description'], $tag->description );998 $this->assertSame( $expected_output['name'], $tag->name ); 999 $this->assertSame( $expected_output['description'], $tag->description ); 1000 1000 1001 1001 // Update the tag. … … 1005 1005 } 1006 1006 $response = rest_get_server()->dispatch( $request ); 1007 $this->assert Equals( 200, $response->get_status() );1007 $this->assertSame( 200, $response->get_status() ); 1008 1008 $actual_output = $response->get_data(); 1009 1009 1010 1010 // Compare expected API output to actual API output. 1011 $this->assert Equals( $expected_output['name'], $actual_output['name'] );1012 $this->assert Equals( $expected_output['description'], $actual_output['description'] );1011 $this->assertSame( $expected_output['name'], $actual_output['name'] ); 1012 $this->assertSame( $expected_output['description'], $actual_output['description'] ); 1013 1013 1014 1014 // Compare expected API output to WP internal values. 1015 1015 $tag = get_term_by( 'id', $actual_output['id'], 'post_tag' ); 1016 $this->assert Equals( $expected_output['name'], $tag->name );1017 $this->assert Equals( $expected_output['description'], $tag->description );1016 $this->assertSame( $expected_output['name'], $tag->name ); 1017 $this->assertSame( $expected_output['description'], $tag->description ); 1018 1018 } 1019 1019 … … 1021 1021 wp_set_current_user( self::$editor ); 1022 1022 1023 $this->assert Equals( ! is_multisite(), current_user_can( 'unfiltered_html' ) );1023 $this->assertSame( ! is_multisite(), current_user_can( 'unfiltered_html' ) ); 1024 1024 $this->verify_tag_roundtrip( 1025 1025 array( … … 1104 1104 $request->set_param( 'force', true ); 1105 1105 $response = rest_get_server()->dispatch( $request ); 1106 $this->assert Equals( 200, $response->get_status() );1106 $this->assertSame( 200, $response->get_status() ); 1107 1107 $data = $response->get_data(); 1108 1108 $this->assertTrue( $data['deleted'] ); 1109 $this->assert Equals( 'Deleted Tag', $data['previous']['name'] );1109 $this->assertSame( 'Deleted Tag', $data['previous']['name'] ); 1110 1110 } 1111 1111 … … 1157 1157 remove_filter( 'map_meta_cap', array( $this, 'grant_delete_term' ), 10, 2 ); 1158 1158 1159 $this->assert Equals( 200, $response->get_status() );1159 $this->assertSame( 200, $response->get_status() ); 1160 1160 $data = $response->get_data(); 1161 1161 $this->assertTrue( $data['deleted'] ); 1162 $this->assert Equals( 'Deleted Tag', $data['previous']['name'] );1162 $this->assertSame( 'Deleted Tag', $data['previous']['name'] ); 1163 1163 } 1164 1164 … … 1211 1211 $term = get_term_by( 'id', $this->factory->tag->create(), 'post_tag' ); 1212 1212 $response = $endpoint->prepare_item_for_response( $term, $request ); 1213 $this->assert Equals(1213 $this->assertSame( 1214 1214 array( 1215 1215 'id', … … 1225 1225 $data = $response->get_data(); 1226 1226 $properties = $data['schema']['properties']; 1227 $this->assert Equals( 8, count( $properties ) );1227 $this->assertSame( 8, count( $properties ) ); 1228 1228 $this->assertArrayHasKey( 'id', $properties ); 1229 1229 $this->assertArrayHasKey( 'count', $properties ); … … 1234 1234 $this->assertArrayHasKey( 'slug', $properties ); 1235 1235 $this->assertArrayHasKey( 'taxonomy', $properties ); 1236 $this->assert Equals( array_keys( get_taxonomies() ), $properties['taxonomy']['enum'] );1236 $this->assertSame( array_keys( get_taxonomies() ), $properties['taxonomy']['enum'] ); 1237 1237 } 1238 1238 … … 1269 1269 $data = $response->get_data(); 1270 1270 $this->assertArrayHasKey( 'my_custom_int', $data['schema']['properties'] ); 1271 $this->assert Equals( $schema, $data['schema']['properties']['my_custom_int'] );1271 $this->assertSame( $schema, $data['schema']['properties']['my_custom_int'] ); 1272 1272 1273 1273 $tag_id = $this->factory->tag->create(); … … 1377 1377 $create->set_param( 'name', 'My New Term' ); 1378 1378 $response = rest_get_server()->dispatch( $create ); 1379 $this->assert Equals( 201, $response->get_status() );1379 $this->assertSame( 201, $response->get_status() ); 1380 1380 $data = $response->get_data(); 1381 1381 $this->assertArrayHasKey( $edit_field, $data ); … … 1385 1385 $update->set_param( 'name', 'My Awesome New Term' ); 1386 1386 $response = rest_get_server()->dispatch( $update ); 1387 $this->assert Equals( 200, $response->get_status() );1387 $this->assertSame( 200, $response->get_status() ); 1388 1388 $data = $response->get_data(); 1389 1389 $this->assertArrayHasKey( $edit_field, $data ); … … 1408 1408 1409 1409 protected function check_get_taxonomy_terms_response( $response ) { 1410 $this->assert Equals( 200, $response->get_status() );1410 $this->assertSame( 200, $response->get_status() ); 1411 1411 $data = $response->get_data(); 1412 1412 $args = array( … … 1414 1414 ); 1415 1415 $tags = get_terms( 'post_tag', $args ); 1416 $this->assert Equals( count( $tags ), count( $data ) );1417 $this->assert Equals( $tags[0]->term_id, $data[0]['id'] );1418 $this->assert Equals( $tags[0]->name, $data[0]['name'] );1419 $this->assert Equals( $tags[0]->slug, $data[0]['slug'] );1420 $this->assert Equals( $tags[0]->taxonomy, $data[0]['taxonomy'] );1421 $this->assert Equals( $tags[0]->description, $data[0]['description'] );1422 $this->assert Equals( $tags[0]->count, $data[0]['count'] );1416 $this->assertSame( count( $tags ), count( $data ) ); 1417 $this->assertSame( $tags[0]->term_id, $data[0]['id'] ); 1418 $this->assertSame( $tags[0]->name, $data[0]['name'] ); 1419 $this->assertSame( $tags[0]->slug, $data[0]['slug'] ); 1420 $this->assertSame( $tags[0]->taxonomy, $data[0]['taxonomy'] ); 1421 $this->assertSame( $tags[0]->description, $data[0]['description'] ); 1422 $this->assertSame( $tags[0]->count, $data[0]['count'] ); 1423 1423 } 1424 1424 1425 1425 protected function check_taxonomy_term( $term, $data, $links ) { 1426 $this->assert Equals( $term->term_id, $data['id'] );1427 $this->assert Equals( $term->name, $data['name'] );1428 $this->assert Equals( $term->slug, $data['slug'] );1429 $this->assert Equals( $term->description, $data['description'] );1430 $this->assert Equals( get_term_link( $term ), $data['link'] );1431 $this->assert Equals( $term->count, $data['count'] );1426 $this->assertSame( $term->term_id, $data['id'] ); 1427 $this->assertSame( $term->name, $data['name'] ); 1428 $this->assertSame( $term->slug, $data['slug'] ); 1429 $this->assertSame( $term->description, $data['description'] ); 1430 $this->assertSame( get_term_link( $term ), $data['link'] ); 1431 $this->assertSame( $term->count, $data['count'] ); 1432 1432 $taxonomy = get_taxonomy( $term->taxonomy ); 1433 1433 if ( $taxonomy->hierarchical ) { 1434 $this->assert Equals( $term->parent, $data['parent'] );1434 $this->assertSame( $term->parent, $data['parent'] ); 1435 1435 } else { 1436 1436 $this->assertFalse( isset( $data['parent'] ) ); … … 1447 1447 $this->assertEqualSets( $expected_links, array_keys( $links ) ); 1448 1448 $this->assertContains( 'wp/v2/taxonomies/' . $term->taxonomy, $links['about'][0]['href'] ); 1449 $this->assert Equals( add_query_arg( 'tags', $term->term_id, rest_url( 'wp/v2/posts' ) ), $links['https://api.w.org/post_type'][0]['href'] );1449 $this->assertSame( add_query_arg( 'tags', $term->term_id, rest_url( 'wp/v2/posts' ) ), $links['https://api.w.org/post_type'][0]['href'] ); 1450 1450 } 1451 1451 1452 1452 protected function check_get_taxonomy_term_response( $response, $id ) { 1453 1453 1454 $this->assert Equals( 200, $response->get_status() );1454 $this->assertSame( 200, $response->get_status() ); 1455 1455 1456 1456 $data = $response->get_data();
Note: See TracChangeset
for help on using the changeset viewer.