Changeset 40921 for trunk/tests/phpunit/tests/taxonomy.php
- Timestamp:
- 06/22/2017 03:18:18 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/taxonomy.php
r40049 r40921 293 293 294 294 /** 295 * @ticket 37094 296 */ 297 public function test_term_assignment_should_invalidate_get_objects_in_term_cache() { 298 register_taxonomy( 'wptests_tax', 'post' ); 299 300 $posts = self::factory()->post->create_many( 2 ); 301 $term_id = self::factory()->term->create( array( 302 'taxonomy' => 'wptests_tax', 303 ) ); 304 305 wp_set_object_terms( $posts[1], $term_id, 'wptests_tax' ); 306 307 // Prime cache. 308 $before = get_objects_in_term( $term_id, 'wptests_tax' ); 309 $this->assertEqualSets( array( $posts[1] ), $before ); 310 311 wp_set_object_terms( $posts[1], array(), 'wptests_tax' ); 312 313 $after = get_objects_in_term( $term_id, 'wptests_tax' ); 314 $this->assertSame( array(), $after ); 315 } 316 317 /** 318 * @ticket 37094 319 */ 320 public function test_term_deletion_should_invalidate_get_objects_in_term_cache() { 321 register_taxonomy( 'wptests_tax', 'post' ); 322 323 $posts = self::factory()->post->create_many( 2 ); 324 $term_id = self::factory()->term->create( array( 325 'taxonomy' => 'wptests_tax', 326 ) ); 327 328 wp_set_object_terms( $posts[1], $term_id, 'wptests_tax' ); 329 330 // Prime cache. 331 $before = get_objects_in_term( $term_id, 'wptests_tax' ); 332 $this->assertEqualSets( array( $posts[1] ), $before ); 333 334 wp_delete_term( $term_id, 'wptests_tax' ); 335 336 $after = get_objects_in_term( $term_id, 'wptests_tax' ); 337 $this->assertSame( array(), $after ); 338 } 339 340 /** 341 * @ticket 37094 342 */ 343 public function test_post_deletion_should_invalidate_get_objects_in_term_cache() { 344 register_taxonomy( 'wptests_tax', 'post' ); 345 346 $posts = self::factory()->post->create_many( 2 ); 347 $term_id = self::factory()->term->create( array( 348 'taxonomy' => 'wptests_tax', 349 ) ); 350 351 wp_set_object_terms( $posts[1], $term_id, 'wptests_tax' ); 352 353 // Prime cache. 354 $before = get_objects_in_term( $term_id, 'wptests_tax' ); 355 $this->assertEqualSets( array( $posts[1] ), $before ); 356 357 wp_delete_post( $posts[1], true ); 358 359 $after = get_objects_in_term( $term_id, 'wptests_tax' ); 360 $this->assertSame( array(), $after ); 361 } 362 363 /** 295 364 * @ticket 25706 296 365 */
Note: See TracChangeset
for help on using the changeset viewer.