Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/xmlrpc/wp/getTerms.php

    r46586 r47122  
    4242                $this->make_user_by_role( 'editor' );
    4343
    44                 // make sure there's at least one category
     44                // Make sure there's at least one category.
    4545                $cat = wp_insert_term( 'term_' . __FUNCTION__, 'category' );
    4646
    … …  
    5151                        $this->assertInternalType( 'int', $term['count'] );
    5252
    53                         // Check custom term meta
     53                        // Check custom term meta.
    5454                        $this->assertInternalType( 'array', $term['custom_fields'] );
    5555
    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.
    5758                        $this->assertStringMatchesFormat( '%d', $term['term_id'] );
    5859                        $this->assertStringMatchesFormat( '%d', $term['term_group'] );
    … …  
    6566                $this->make_user_by_role( 'editor' );
    6667
    67                 // create a taxonomy and some terms for it
     68                // Create a taxonomy and some terms for it.
    6869                $tax_name  = 'wp_getTerms_custom_taxonomy';
    6970                $num_terms = 12;
    … …  
    7374                }
    7475
    75                 // test fetching all terms
     76                // Test fetching all terms.
    7677                $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name ) );
    7778                $this->assertNotIXRError( $results );
    … …  
    8283                }
    8384
    84                 // test paged results
     85                // Test paged results.
    8586                $filter   = array( 'number' => 5 );
    8687                $results2 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
    8788                $this->assertNotIXRError( $results );
    8889                $this->assertEquals( 5, count( $results2 ) );
    89                 $this->assertEquals( $results[1]['term_id'], $results2[1]['term_id'] ); // check one of the terms
     90                $this->assertEquals( $results[1]['term_id'], $results2[1]['term_id'] ); // Check one of the terms.
    9091
    9192                $filter['offset'] = 10;
    … …  
    9596                $this->assertEquals( $results[11]['term_id'], $results3[1]['term_id'] );
    9697
    97                 // test hide_empty (since none have been attached to posts yet, all should be hidden
     98                // Test hide_empty (since none have been attached to posts yet, all should be hidden.
    9899                $filter   = array( 'hide_empty' => true );
    99100                $results4 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
    … …  
    123124                foreach ( $results as $term ) {
    124125                        if ( $term['term_id'] === $cat1 ) {
    125                                 break;  // found cat1 first as expected
     126                                break; // Found cat1 first as expected.
    126127                        } elseif ( $term['term_id'] === $cat2 ) {
    127128                                $this->assertFalse( false, 'Incorrect category ordering.' );
    … …  
    136137                $name_id = wp_create_category( $name );
    137138
    138                 // search by full name
     139                // Search by full name.
    139140                $filter  = array( 'search' => $name );
    140141                $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
    … …  
    144145                $this->assertEquals( $name_id, $results[0]['term_id'] );
    145146
    146                 // search by partial name
     147                // Search by partial name.
    147148                $filter   = array( 'search' => substr( $name, 0, 10 ) );
    148149                $results2 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
Note: See TracChangeset for help on using the changeset viewer.