Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (6 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/term/getTerms.php

    r46586 r47122  
    114114        $num_queries = $wpdb->num_queries;
    115115
    116         // last_changed and num_queries should bump
     116        // last_changed and num_queries should bump.
    117117        $terms = get_terms( 'post_tag', array( 'update_term_meta_cache' => false ) );
    118118        $this->assertEquals( 3, count( $terms ) );
     
    138138        $this->set_up_three_posts_and_tags();
    139139
    140         // Prime cache
     140        // Prime cache.
    141141        $terms       = get_terms( 'post_tag' );
    142142        $time1       = wp_cache_get( 'last_changed', 'terms' );
     
    166166        $this->set_up_three_posts_and_tags();
    167167
    168         // Prime cache
     168        // Prime cache.
    169169        $terms       = get_terms( 'post_tag' );
    170170        $time1       = wp_cache_get( 'last_changed', 'terms' );
     
    776776     */
    777777    function test_get_term_children_recursion() {
    778         // Assume there is a way to insert a term with the parent pointing to itself
     778        // Assume there is a way to insert a term with the parent pointing to itself.
    779779        // See: https://core.trac.wordpress.org/changeset/15806
    780780        remove_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10 );
     
    927927        $this->assertEqualSets( array( $t ), $found );
    928928
    929         // array format.
     929        // Array format.
    930930        $found = get_terms(
    931931            'wptests_tax',
     
    10261026            PEI
    10271027        */
    1028         // Level 1
     1028        // Level 1.
    10291029        $canada = self::factory()->term->create(
    10301030            array(
     
    10341034        );
    10351035
    1036         // Level 2
     1036        // Level 2.
    10371037        $ontario = self::factory()->term->create(
    10381038            array(
     
    10571057        );
    10581058
    1059         // Level 3
     1059        // Level 3.
    10601060        $toronto  = self::factory()->term->create(
    10611061            array(
     
    10801080        );
    10811081
    1082         // Level 4
     1082        // Level 4.
    10831083        $nepean = self::factory()->term->create(
    10841084            array(
     
    11081108        register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
    11091109
    1110         // Level 1
     1110        // Level 1.
    11111111        $canada = self::factory()->term->create(
    11121112            array(
     
    11161116        );
    11171117
    1118         // Level 2
     1118        // Level 2.
    11191119        $ontario = self::factory()->term->create(
    11201120            array(
     
    11321132        );
    11331133
    1134         // Level 3
     1134        // Level 3.
    11351135        $laval    = self::factory()->term->create(
    11361136            array(
     
    11481148        );
    11491149
    1150         // Level 4
     1150        // Level 4.
    11511151        $dorval = self::factory()->term->create(
    11521152            array(
     
    22222222        $initial_terms = $this->create_hierarchical_terms();
    22232223
    2224         // Case where hierarchical is false
     2224        // Case where hierarchical is false.
    22252225        $terms = get_terms(
    22262226            'category',
     
    22312231        );
    22322232
    2233         // Verify that there are no children
     2233        // Verify that there are no children.
    22342234        $this->assertEquals( 0, count( $terms ) );
    22352235    }
     
    22412241        $initial_terms = $this->create_hierarchical_terms();
    22422242
    2243         // Case where hierarchical is true
     2243        // Case where hierarchical is true.
    22442244        $terms = get_terms(
    22452245            'category',
     
    22502250        );
    22512251
    2252         // Verify that the children with non-empty descendants are returned
     2252        // Verify that the children with non-empty descendants are returned.
    22532253        $expected = array(
    22542254            $initial_terms['two_term']['term_id'],
     
    22682268        );
    22692269
    2270         // Case where hierarchical is false
     2270        // Case where hierarchical is false.
    22712271        $terms = get_terms(
    22722272            'category',
     
    22882288        $initial_terms = $this->create_hierarchical_terms();
    22892289
    2290         // Case where hierarchical is false
     2290        // Case where hierarchical is false.
    22912291        $terms = get_terms(
    22922292            'category',
     
    22972297        );
    22982298
    2299         // Verify that there are no children
     2299        // Verify that there are no children.
    23002300        $this->assertEquals( 0, count( $terms ) );
    23012301    }
     
    23042304        $initial_terms = $this->create_hierarchical_terms();
    23052305
    2306         // Case where hierarchical is true
     2306        // Case where hierarchical is true.
    23072307        $terms = get_terms(
    23082308            'category',
     
    24002400        $initial_terms = $this->create_hierarchical_terms();
    24012401
    2402         // Case where hierarchical is false
     2402        // Case where hierarchical is false.
    24032403        $terms = get_terms(
    24042404            'category',
     
    24102410        );
    24112411
    2412         // hierarchical=false means that descendants are not fetched.
     2412        // 'hierarchical=false' means that descendants are not fetched.
    24132413        $this->assertEquals( 0, count( $terms ) );
    24142414    }
     
    24202420        $initial_terms = $this->create_hierarchical_terms();
    24212421
    2422         // Case where hierarchical is true
     2422        // Case where hierarchical is true.
    24232423        $terms = get_terms(
    24242424            'category',
     
    24302430        );
    24312431
    2432         // Verify that parent takes precedence over child_of
     2432        // Verify that parent takes precedence over child_of.
    24332433        $expected = array(
    24342434            $initial_terms['two_term']['term_id'],
     
    29982998
    29992999    protected function create_hierarchical_terms() {
    3000         // Set up the following hierarchy:
    3001         // - One
    3002         //   - Two
    3003         //     - Three (1)
    3004         //     - Four
    3005         //   - Five
    3006         //     - Six (1)
    3007         //   - Seven
     3000        /*
     3001         * Set up the following hierarchy:
     3002         * - One
     3003         *   - Two
     3004         *     - Three (1)
     3005         *     - Four
     3006         *   - Five
     3007         *     - Six (1)
     3008         *   - Seven
     3009         */
    30083010        $one_term   = wp_insert_term(
    30093011            'One',
     
    30533055        );
    30543056
    3055         // Ensure child terms are not empty
     3057        // Ensure child terms are not empty.
    30563058        $first_post_id  = self::factory()->post->create();
    30573059        $second_post_id = self::factory()->post->create();
Note: See TracChangeset for help on using the changeset viewer.