Changeset 27163 for trunk/tests/phpunit/tests/term/cache.php
- Timestamp:
- 02/11/2014 04:49:11 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/term/cache.php
r27142 r27163 33 33 * @ticket 22526 34 34 */ 35 function test_get_taxonomy_last_changed() {36 $last_changed = get_taxonomy_last_changed( 'category' );37 $key = 'category_last_changed';38 $last_changed_cache = wp_cache_get( $key, 'terms' );39 $this->assertEquals( $last_changed, $last_changed_cache );40 wp_cache_delete( $key, 'terms' );41 $this->assertEquals( $last_changed, $last_changed_cache );42 $last_changed = get_taxonomy_last_changed( 'category' );43 $this->assertNotEquals( $last_changed, $last_changed_cache );44 45 $last_changed2 = get_taxonomy_last_changed( 'category' );46 $this->factory->category->create();47 $last_changed3 = get_taxonomy_last_changed( 'category' );48 $this->assertNotEquals( $last_changed2, $last_changed3 );49 }50 51 /**52 * @ticket 2252653 */54 function test_set_taxonomy_last_changed() {55 $last_changed1 = set_taxonomy_last_changed( 'category' );56 $last_changed2 = set_taxonomy_last_changed( 'category' );57 $this->assertNotEquals( $last_changed1, $last_changed2 );58 59 $last_changed3 = set_taxonomy_last_changed( 'category' );60 $last_changed4 = get_taxonomy_last_changed( 'category' );61 $this->assertEquals( $last_changed3, $last_changed4 );62 }63 64 /**65 * @ticket 2252666 */67 function test_post_taxonomy_is_fresh() {68 $post_id = $this->factory->post->create();69 $term_id = $this->factory->category->create( array( 'name' => 'Foo' ) );70 wp_set_post_categories( $post_id, $term_id );71 72 $this->assertFalse( post_taxonomy_is_fresh( $post_id, 'category' ) );73 $this->assertTrue( post_taxonomy_is_fresh( $post_id, 'category' ) );74 $this->assertTrue( post_taxonomy_is_fresh( $post_id, 'category' ) );75 76 wp_update_term( $term_id, 'category', array( 'name' => 'Bar' ) );77 78 $this->assertFalse( post_taxonomy_is_fresh( $post_id, 'category' ) );79 get_the_category( $post_id );80 $this->assertTrue( post_taxonomy_is_fresh( $post_id, 'category' ) );81 }82 83 /**84 * @ticket 2252685 */86 35 function test_category_name_change() { 87 36 $term = $this->factory->category->create_and_get( array( 'name' => 'Foo' ) ); … … 98 47 } 99 48 49 /** 50 * @ticket 14485 51 */ 100 52 function test_hierachy_invalidation() { 101 53 $tax = 'burrito'; … … 127 79 $terms = get_terms( $tax, array( 'hide_empty' => false ) ); 128 80 $this->assertEquals( $i, count( $terms ) ); 129 if ( 1 < $i) {81 if ( $i > 1 ) { 130 82 $hierarchy = _get_term_hierarchy( $tax ); 131 83 $this->assertNotEmpty( $hierarchy );
Note: See TracChangeset
for help on using the changeset viewer.