Changeset 47122 for trunk/tests/phpunit/tests/xmlrpc/wp/getTerms.php
- Timestamp:
- 01/29/2020 12:43:23 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/xmlrpc/wp/getTerms.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/xmlrpc/wp/getTerms.php
r46586 r47122 42 42 $this->make_user_by_role( 'editor' ); 43 43 44 // make sure there's at least one category44 // Make sure there's at least one category. 45 45 $cat = wp_insert_term( 'term_' . __FUNCTION__, 'category' ); 46 46 … … 51 51 $this->assertInternalType( 'int', $term['count'] ); 52 52 53 // Check custom term meta 53 // Check custom term meta. 54 54 $this->assertInternalType( 'array', $term['custom_fields'] ); 55 55 56 // We expect all other IDs to be strings not integers so we don't return something larger than an XMLRPC integer can describe. 56 // We expect all other IDs to be strings, not integers, 57 // so we don't return something larger than an XMLRPC integer can describe. 57 58 $this->assertStringMatchesFormat( '%d', $term['term_id'] ); 58 59 $this->assertStringMatchesFormat( '%d', $term['term_group'] ); … … 65 66 $this->make_user_by_role( 'editor' ); 66 67 67 // create a taxonomy and some terms for it68 // Create a taxonomy and some terms for it. 68 69 $tax_name = 'wp_getTerms_custom_taxonomy'; 69 70 $num_terms = 12; … … 73 74 } 74 75 75 // test fetching all terms76 // Test fetching all terms. 76 77 $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name ) ); 77 78 $this->assertNotIXRError( $results ); … … 82 83 } 83 84 84 // test paged results85 // Test paged results. 85 86 $filter = array( 'number' => 5 ); 86 87 $results2 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) ); 87 88 $this->assertNotIXRError( $results ); 88 89 $this->assertEquals( 5, count( $results2 ) ); 89 $this->assertEquals( $results[1]['term_id'], $results2[1]['term_id'] ); // check one of the terms90 $this->assertEquals( $results[1]['term_id'], $results2[1]['term_id'] ); // Check one of the terms. 90 91 91 92 $filter['offset'] = 10; … … 95 96 $this->assertEquals( $results[11]['term_id'], $results3[1]['term_id'] ); 96 97 97 // test hide_empty (since none have been attached to posts yet, all should be hidden98 // Test hide_empty (since none have been attached to posts yet, all should be hidden. 98 99 $filter = array( 'hide_empty' => true ); 99 100 $results4 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) ); … … 123 124 foreach ( $results as $term ) { 124 125 if ( $term['term_id'] === $cat1 ) { 125 break; // found cat1 first as expected126 break; // Found cat1 first as expected. 126 127 } elseif ( $term['term_id'] === $cat2 ) { 127 128 $this->assertFalse( false, 'Incorrect category ordering.' ); … … 136 137 $name_id = wp_create_category( $name ); 137 138 138 // search by full name139 // Search by full name. 139 140 $filter = array( 'search' => $name ); 140 141 $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) ); … … 144 145 $this->assertEquals( $name_id, $results[0]['term_id'] ); 145 146 146 // search by partial name147 // Search by partial name. 147 148 $filter = array( 'search' => substr( $name, 0, 10 ) ); 148 149 $results2 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
Note: See TracChangeset
for help on using the changeset viewer.