diff --git tests/phpunit/tests/rest-api/rest-categories-controller.php tests/phpunit/tests/rest-api/rest-categories-controller.php
index 79add82..3c95438 100644
|
|
|
class WP_Test_REST_Categories_Controller extends WP_Test_REST_Controller_Testcas |
| 690 | 690 | $this->check_get_taxonomy_term_response( $response ); |
| 691 | 691 | } |
| 692 | 692 | |
| | 693 | /** |
| | 694 | * @ticket 39122 |
| | 695 | */ |
| 693 | 696 | public function test_get_item_meta() { |
| 694 | 697 | $request = new WP_REST_Request( 'GET', '/wp/v2/categories/1' ); |
| 695 | 698 | $response = rest_get_server()->dispatch( $request ); |
| … |
… |
class WP_Test_REST_Categories_Controller extends WP_Test_REST_Controller_Testcas |
| 698 | 701 | |
| 699 | 702 | $meta = (array) $data['meta']; |
| 700 | 703 | $this->assertArrayHasKey( 'test_single', $meta ); |
| 701 | | $this->assertEquals( $meta['test_single'], '' ); |
| | 704 | $this->assertSame( $meta['test_single'], '' ); |
| 702 | 705 | $this->assertArrayHasKey( 'test_multi', $meta ); |
| 703 | | $this->assertEquals( $meta['test_multi'], array() ); |
| | 706 | $this->assertSame( $meta['test_multi'], array() ); |
| 704 | 707 | $this->assertArrayHasKey( 'test_cat_single', $meta ); |
| 705 | | $this->assertEquals( $meta['test_cat_single'], '' ); |
| | 708 | $this->assertSame( $meta['test_cat_single'], '' ); |
| 706 | 709 | $this->assertArrayHasKey( 'test_cat_multi', $meta ); |
| 707 | | $this->assertEquals( $meta['test_cat_multi'], array() ); |
| | 710 | $this->assertSame( $meta['test_cat_multi'], array() ); |
| 708 | 711 | } |
| 709 | 712 | |
| | 713 | /** |
| | 714 | * @ticket 39122 |
| | 715 | */ |
| 710 | 716 | public function test_get_item_meta_registered_for_different_taxonomy() { |
| 711 | 717 | $request = new WP_REST_Request( 'GET', '/wp/v2/categories/1' ); |
| 712 | 718 | $response = rest_get_server()->dispatch( $request ); |
| 713 | 719 | $data = $response->get_data(); |
| 714 | 720 | $this->assertArrayHasKey( 'meta', $data ); |
| 715 | | $this->assertArrayHasKey( 'meta', $data ); |
| 716 | 721 | |
| 717 | 722 | $meta = (array) $data['meta']; |
| 718 | | $this->assertEquals( false, isset( $meta['test_tag_meta'] ) ); |
| | 723 | $this->assertFalse( isset( $meta['test_tag_meta'] ) ); |
| 719 | 724 | } |
| 720 | 725 | |
| 721 | 726 | public function test_get_term_invalid_taxonomy() { |
diff --git tests/phpunit/tests/rest-api/rest-tags-controller.php tests/phpunit/tests/rest-api/rest-tags-controller.php
index 6bd275c..f850aa6 100644
|
|
|
class WP_Test_REST_Tags_Controller extends WP_Test_REST_Controller_Testcase { |
| 629 | 629 | $this->check_get_taxonomy_term_response( $response, $id ); |
| 630 | 630 | } |
| 631 | 631 | |
| | 632 | /** |
| | 633 | * @ticket 39122 |
| | 634 | */ |
| 632 | 635 | public function test_get_item_meta() { |
| 633 | 636 | $id = $this->factory->tag->create(); |
| 634 | 637 | $request = new WP_REST_Request( 'GET', '/wp/v2/tags/' . $id ); |
| … |
… |
class WP_Test_REST_Tags_Controller extends WP_Test_REST_Controller_Testcase { |
| 638 | 641 | |
| 639 | 642 | $meta = (array) $data['meta']; |
| 640 | 643 | $this->assertArrayHasKey( 'test_single', $meta ); |
| 641 | | $this->assertEquals( $meta['test_single'], '' ); |
| | 644 | $this->assertSame( $meta['test_single'], '' ); |
| 642 | 645 | $this->assertArrayHasKey( 'test_multi', $meta ); |
| 643 | | $this->assertEquals( $meta['test_multi'], array() ); |
| | 646 | $this->assertSame( $meta['test_multi'], array() ); |
| 644 | 647 | $this->assertArrayHasKey( 'test_tag_single', $meta ); |
| 645 | | $this->assertEquals( $meta['test_tag_single'], '' ); |
| | 648 | $this->assertSame( $meta['test_tag_single'], '' ); |
| 646 | 649 | $this->assertArrayHasKey( 'test_tag_multi', $meta ); |
| 647 | | $this->assertEquals( $meta['test_tag_multi'], array() ); |
| | 650 | $this->assertSame( $meta['test_tag_multi'], array() ); |
| 648 | 651 | } |
| 649 | 652 | |
| | 653 | /** |
| | 654 | * @ticket 39122 |
| | 655 | */ |
| 650 | 656 | public function test_get_item_meta_registered_for_different_taxonomy() { |
| 651 | 657 | $id = $this->factory->tag->create(); |
| 652 | 658 | $request = new WP_REST_Request( 'GET', '/wp/v2/tags/' . $id ); |
| … |
… |
class WP_Test_REST_Tags_Controller extends WP_Test_REST_Controller_Testcase { |
| 655 | 661 | $this->assertArrayHasKey( 'meta', $data ); |
| 656 | 662 | |
| 657 | 663 | $meta = (array) $data['meta']; |
| 658 | | $this->assertEquals( false, isset( $meta['test_cat_meta'] ) ); |
| | 664 | $this->assertFalse( isset( $meta['test_cat_meta'] ) ); |
| 659 | 665 | } |
| 660 | 666 | |