WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/15/2014 03:50:46 AM (8 years ago)
Author:
wonderboymusic
Message:

Eliminate use of extract() in get_the_taxonomies(). Adds unit test.

See #22400.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/taxonomy.php

    r28374 r28415  
    3434    }
    3535
     36    function test_get_the_taxonomies() {
     37        $post_id = $this->factory->post->create();
     38
     39        $taxes = get_the_taxonomies( $post_id );
     40        $this->assertNotEmpty( $taxes );
     41        $this->assertEquals( array( 'category' ), array_keys( $taxes ) );
     42
     43        $id = $this->factory->tag->create();
     44        wp_set_post_tags( $post_id, array( $id ) );
     45
     46        $taxes = get_the_taxonomies( $post_id );
     47        $this->assertNotEmpty( $taxes );
     48        $this->assertCount( 2, $taxes );
     49        $this->assertEquals( array( 'category', 'post_tag' ), array_keys( $taxes ) );
     50    }
     51
    3652    function test_get_link_taxonomy() {
    3753        foreach ( get_object_taxonomies('link') as $taxonomy ) {
Note: See TracChangeset for help on using the changeset viewer.