Make WordPress Core

Changeset 27099


Ignore:
Timestamp:
02/05/2014 03:49:48 AM (11 years ago)
Author:
wonderboymusic
Message:

Add a unit test demonstrating the failure to invalidate a post's term cache when the term is updated.

See #22526.

File:
1 edited

Legend:

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

    r26511 r27099  
    568568        $this->assertEquals( 0, $count );
    569569    }
     570
     571    /**
     572     * @ticket 22526
     573     */
     574    function test_category_name_change() {
     575        $term = $this->factory->category->create_and_get( array( 'name' => 'Foo' ) );
     576        $post_id = $this->factory->post->create();
     577        wp_set_post_categories( $post_id, $term->term_id );
     578
     579        $post = get_post( $post_id );
     580        $cats1 = get_the_category( $post->ID );
     581        $this->assertEquals( $term->name, reset( $cats1 )->name );
     582
     583        wp_update_term( $term->term_id, 'category', array( 'name' => 'Bar' ) );
     584        $cats2 = get_the_category( $post->ID );
     585        $this->assertNotEquals( $term->name, reset( $cats2 )->name );
     586    }
    570587}
Note: See TracChangeset for help on using the changeset viewer.