Make WordPress Core

Changeset 28421


Ignore:
Timestamp:
05/15/2014 05:24:54 AM (10 years ago)
Author:
wonderboymusic
Message:

Eliminate the use of extract() in the_taxonomies(). Adds unit test.

See #22400.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r28415 r28421  
    36863686 * @param array $args Override the defaults.
    36873687 */
    3688 function the_taxonomies($args = array()) {
     3688function the_taxonomies( $args = array() ) {
    36893689    $defaults = array(
    36903690        'post' => 0,
     
    36963696
    36973697    $r = wp_parse_args( $args, $defaults );
    3698     extract( $r, EXTR_SKIP );
    3699 
    3700     echo $before . join($sep, get_the_taxonomies($post, $r)) . $after;
     3698
     3699    echo $r['before'] . join( $r['sep'], get_the_taxonomies( $r['post'], $r ) ) . $r['after'];
    37013700}
    37023701
  • trunk/tests/phpunit/tests/taxonomy.php

    r28415 r28421  
    5050    }
    5151
     52    function test_the_taxonomies() {
     53        $post_id = $this->factory->post->create();
     54
     55        ob_start();
     56        the_taxonomies( array( 'post' => $post_id ) );
     57        $output = ob_get_clean();
     58
     59        $link = get_category_link( 1 );
     60        $expected = "Categories: <a href='$link'>Uncategorized</a>.";
     61        $this->assertEquals( $expected, $output );
     62    }
     63
    5264    function test_get_link_taxonomy() {
    5365        foreach ( get_object_taxonomies('link') as $taxonomy ) {
Note: See TracChangeset for help on using the changeset viewer.