Changeset 47122 for trunk/tests/phpunit/tests/xmlrpc/wp/getPosts.php
- Timestamp:
- 01/29/2020 12:43:23 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/xmlrpc/wp/getPosts.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/xmlrpc/wp/getPosts.php
r46586 r47122 65 65 ); 66 66 } 67 // get them all67 // Get them all. 68 68 $filter = array( 69 69 'post_type' => $cpt_name, … … 74 74 $this->assertEquals( $num_posts, count( $results ) ); 75 75 76 // page through results76 // Page through results. 77 77 $posts_found = array(); 78 78 $filter['number'] = 2; … … 83 83 $filter['offset'] += $filter['number']; 84 84 } while ( count( $presults ) > 0 ); 85 // verify that $post_ids matches $posts_found85 // Verify that $post_ids matches $posts_found. 86 86 $this->assertEquals( 0, count( array_diff( $post_ids, $posts_found ) ) ); 87 87 88 // add comments to some of the posts88 // Add comments to some of the posts. 89 89 foreach ( $post_ids as $key => $post_id ) { 90 90 // Larger post IDs will get more comments. … … 92 92 } 93 93 94 // get results ordered by comment count94 // Get results ordered by comment count. 95 95 $filter2 = array( 96 96 'post_type' => $cpt_name, … … 108 108 } 109 109 110 // set one of the posts to draft and get drafts110 // Set one of the posts to draft and get drafts. 111 111 $post = get_post( $post_ids[0] ); 112 112 $post->post_status = 'draft'; … … 128 128 self::factory()->post->create(); 129 129 130 // check default fields130 // Check default fields. 131 131 $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor' ) ); 132 132 $this->assertNotIXRError( $results ); 133 $expected_fields = array( 'post_id', 'post_title', 'terms', 'custom_fields', 'link' ); // subset of expected fields133 $expected_fields = array( 'post_id', 'post_title', 'terms', 'custom_fields', 'link' ); // Subset of expected fields. 134 134 foreach ( $expected_fields as $field ) { 135 135 $this->assertArrayHasKey( $field, $results[0] ); 136 136 } 137 137 138 // request specific fields and verify that only those are returned138 // Request specific fields and verify that only those are returned. 139 139 $filter = array(); 140 140 $fields = array( 'post_name', 'post_author', 'enclosure' ); … … 156 156 $post_ids[] = self::factory()->post->create( array( 'post_title' => 'Second: Hello, World!' ) ); 157 157 158 // Search for none of them 158 // Search for none of them. 159 159 $filter = array( 's' => 'Third' ); 160 160 $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) ); … … 162 162 $this->assertEquals( 0, count( $results ) ); 163 163 164 // Search for one of them 164 // Search for one of them. 165 165 $filter = array( 's' => 'First:' ); 166 166 $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
Note: See TracChangeset
for help on using the changeset viewer.