WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.4/tests/phpunit/tests/term.php

    r35246 r36057  
    618618
    619619    /**
     620     * @ticket 35180
     621     * @ticket 28922
     622     */
     623    public function test_get_the_terms_should_return_results_ordered_by_name_when_pulling_from_cache() {
     624        register_taxonomy( 'wptests_tax', 'post' );
     625        $p = self::$post_ids[0];
     626
     627        $t1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'fff' ) );
     628        $t2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'aaa' ) );
     629        $t3 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'zzz' ) );
     630
     631        wp_set_object_terms( $p, array( $t1, $t2, $t3 ), 'wptests_tax' );
     632        update_object_term_cache( $p, 'post' );
     633
     634        $found = get_the_terms( $p, 'wptests_tax' );
     635
     636        $this->assertSame( array( $t2, $t1, $t3 ), wp_list_pluck( $found, 'term_id' ) );
     637    }
     638
     639    /**
    620640     * @ticket 19205
    621641     */
     
    628648        $this->assertWPError( $cat_id2 );
    629649    }
     650
     651    /**
     652     * @ticket 34723
     653     */
     654    function test_get_the_terms_should_return_wp_error_when_taxonomy_is_unregistered() {
     655        $p = self::$post_ids[0];
     656        $terms = get_the_terms( $p, 'this-taxonomy-does-not-exist' );
     657        $this->assertTrue( is_wp_error( $terms ) );
     658    }
    630659}
Note: See TracChangeset for help on using the changeset viewer.