Make WordPress Core


Ignore:
Timestamp:
12/09/2016 04:09:31 PM (8 years ago)
Author:
boonebgorges
Message:

Taxonomy: Introduce get_term_parents_list().

This new function is a taxonomy-agnostic version of get_category_parents().

Props keesiemeijer, SergeyBiryukov, rafaehlers.
Fixes #17069.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/category/getCategoryParents.php

    r36778 r39549  
    5151    }
    5252
    53     public function test_visited_should_also_exclude_children_of_visited_categories() {
    54         $c3 = self::factory()->category->create_and_get( array(
    55             'parent' => $this->c2->term_id,
    56         ) );
    57         $c4 = self::factory()->category->create_and_get( array(
    58             'parent' => $c3->term_id,
    59         ) );
     53    public function test_deprecated_argument_visited() {
     54        $this->setExpectedDeprecated( 'get_category_parents' );
     55        $found = get_category_parents( $this->c2->term_id, false, '/', false, array( $this->c1->term_id ) );
     56    }
    6057
    61         $expected = $this->c1->name . '/'. $this->c2->name . '/';
    62         $found = get_category_parents( $this->c2->term_id, false, '/', false, array( $c3->term_id ) );
     58    public function test_category_without_parents() {
     59        $expected = $this->c1->name . '/';
     60        $found = get_category_parents( $this->c1->term_id );
    6361        $this->assertSame( $expected, $found );
    6462    }
Note: See TracChangeset for help on using the changeset viewer.