- Timestamp:
- 09/11/2022 09:10:31 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-search-controller.php
r53760 r54123 820 820 } 821 821 822 /** 823 * @ticket 56546 824 */ 825 public function test_get_items_search_posts_include_ids() { 826 $response = $this->do_request_with_params( 827 array( 828 'include' => array_slice( self::$my_title_post_ids, 1, 2 ), 829 ) 830 ); 831 832 $this->assertSame( 200, $response->get_status() ); 833 $this->assertSameSets( 834 array( self::$my_title_post_ids[1], self::$my_title_post_ids[2] ), 835 wp_list_pluck( $response->get_data(), 'id' ) 836 ); 837 } 838 839 /** 840 * @ticket 56546 841 */ 842 public function test_get_items_search_posts_exclude_ids() { 843 $response = $this->do_request_with_params( 844 array( 845 'exclude' => self::$my_title_page_ids, 846 ) 847 ); 848 849 $this->assertSame( 200, $response->get_status() ); 850 $this->assertSameSets( 851 array_merge( 852 self::$my_title_post_ids, 853 self::$my_content_post_ids 854 ), 855 wp_list_pluck( $response->get_data(), 'id' ) 856 ); 857 } 858 859 /** 860 * @ticket 56546 861 */ 862 public function test_get_items_search_terms_include_ids() { 863 $response = $this->do_request_with_params( 864 array( 865 'include' => self::$my_tag_id, 866 'type' => 'term', 867 ) 868 ); 869 870 $this->assertSame( 200, $response->get_status() ); 871 $this->assertSameSets( 872 array( self::$my_tag_id ), 873 wp_list_pluck( $response->get_data(), 'id' ) 874 ); 875 } 876 877 /** 878 * @ticket 56546 879 */ 880 public function test_get_items_search_terms_exclude_ids() { 881 $response = $this->do_request_with_params( 882 array( 883 // "1" is the default category. 884 'exclude' => array( 1, self::$my_tag_id ), 885 'type' => 'term', 886 ) 887 ); 888 889 $this->assertSame( 200, $response->get_status() ); 890 $this->assertSameSets( 891 array( self::$my_category_id ), 892 wp_list_pluck( $response->get_data(), 'id' ) 893 ); 894 } 895 822 896 }
Note: See TracChangeset
for help on using the changeset viewer.