Eliminate the use of extract()
in the_taxonomies()
. Adds unit test.
See #22400. git-svn-id: https://develop.svn.wordpress.org/trunk@28421 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a3c9e611a8
commit
17edee17af
@ -3695,9 +3695,8 @@ function the_taxonomies($args = array()) {
|
||||
);
|
||||
|
||||
$r = wp_parse_args( $args, $defaults );
|
||||
extract( $r, EXTR_SKIP );
|
||||
|
||||
echo $before . join($sep, get_the_taxonomies($post, $r)) . $after;
|
||||
echo $r['before'] . join( $r['sep'], get_the_taxonomies( $r['post'], $r ) ) . $r['after'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -49,6 +49,18 @@ class Tests_Taxonomy extends WP_UnitTestCase {
|
||||
$this->assertEquals( array( 'category', 'post_tag' ), array_keys( $taxes ) );
|
||||
}
|
||||
|
||||
function test_the_taxonomies() {
|
||||
$post_id = $this->factory->post->create();
|
||||
|
||||
ob_start();
|
||||
the_taxonomies( array( 'post' => $post_id ) );
|
||||
$output = ob_get_clean();
|
||||
|
||||
$link = get_category_link( 1 );
|
||||
$expected = "Categories: <a href='$link'>Uncategorized</a>.";
|
||||
$this->assertEquals( $expected, $output );
|
||||
}
|
||||
|
||||
function test_get_link_taxonomy() {
|
||||
foreach ( get_object_taxonomies('link') as $taxonomy ) {
|
||||
$tax = get_taxonomy($taxonomy);
|
||||
|
Loading…
Reference in New Issue
Block a user