- Timestamp:
- 12/18/2015 06:13:58 PM (9 years ago)
- Location:
- branches/4.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.4
-
branches/4.4/tests/phpunit/tests/category/wpListCategories.php
r35242 r36006 308 308 $this->assertNotContains( '<li class="cat-item cat-item-' . $child2 . '">', $actual ); 309 309 } 310 311 /** 312 * @ticket 35156 313 */ 314 public function test_comma_separated_exclude_tree_should_be_merged_with_exclude() { 315 $c = self::factory()->category->create(); 316 $parent = self::factory()->category->create( array( 'name' => 'Parent', 'slug' => 'parent' ) ); 317 $child = self::factory()->category->create( array( 'name' => 'Child', 'slug' => 'child', 'parent' => $parent ) ); 318 $parent2 = self::factory()->category->create( array( 'name' => 'Parent', 'slug' => 'parent2' ) ); 319 $child2 = self::factory()->category->create( array( 'name' => 'Child', 'slug' => 'child2', 'parent' => $parent2 ) ); 320 $parent3 = self::factory()->category->create( array( 'name' => 'Parent', 'slug' => 'parent3' ) ); 321 $child3 = self::factory()->category->create( array( 'name' => 'Child', 'slug' => 'child3', 'parent' => $parent3 ) ); 322 $parent4 = self::factory()->category->create( array( 'name' => 'Parent', 'slug' => 'parent4' ) ); 323 $child4 = self::factory()->category->create( array( 'name' => 'Child', 'slug' => 'child4', 'parent' => $parent4 ) ); 324 325 326 $args = array( 'echo' => 0, 'hide_empty' => 0, 'exclude_tree' => $parent ); 327 328 $actual = wp_list_categories( array( 329 'echo' => 0, 330 'hide_empty' => 0, 331 'exclude' => "$parent,$parent2", 332 'exclude_tree' => "$parent3,$parent4", 333 ) ); 334 335 $this->assertContains( '<li class="cat-item cat-item-' . $c . '">', $actual ); 336 337 $this->assertNotContains( '<li class="cat-item cat-item-' . $parent . '">', $actual ); 338 $this->assertNotContains( '<li class="cat-item cat-item-' . $parent2 . '">', $actual ); 339 $this->assertNotContains( '<li class="cat-item cat-item-' . $child . '">', $actual ); 340 $this->assertNotContains( '<li class="cat-item cat-item-' . $child2 . '">', $actual ); 341 342 $this->assertNotContains( '<li class="cat-item cat-item-' . $parent3 . '">', $actual ); 343 $this->assertNotContains( '<li class="cat-item cat-item-' . $parent4 . '">', $actual ); 344 $this->assertNotContains( '<li class="cat-item cat-item-' . $child3 . '">', $actual ); 345 $this->assertNotContains( '<li class="cat-item cat-item-' . $child4 . '">', $actual ); 346 } 347 348 /** 349 * @ticket 35156 350 */ 351 public function test_array_exclude_tree_should_be_merged_with_exclude() { 352 $c = self::factory()->category->create(); 353 $parent = self::factory()->category->create( array( 'name' => 'Parent', 'slug' => 'parent' ) ); 354 $child = self::factory()->category->create( array( 'name' => 'Child', 'slug' => 'child', 'parent' => $parent ) ); 355 $parent2 = self::factory()->category->create( array( 'name' => 'Parent', 'slug' => 'parent2' ) ); 356 $child2 = self::factory()->category->create( array( 'name' => 'Child', 'slug' => 'child2', 'parent' => $parent2 ) ); 357 $parent3 = self::factory()->category->create( array( 'name' => 'Parent', 'slug' => 'parent3' ) ); 358 $child3 = self::factory()->category->create( array( 'name' => 'Child', 'slug' => 'child3', 'parent' => $parent3 ) ); 359 $parent4 = self::factory()->category->create( array( 'name' => 'Parent', 'slug' => 'parent4' ) ); 360 $child4 = self::factory()->category->create( array( 'name' => 'Child', 'slug' => 'child4', 'parent' => $parent4 ) ); 361 362 363 $args = array( 'echo' => 0, 'hide_empty' => 0, 'exclude_tree' => $parent ); 364 365 $actual = wp_list_categories( array( 366 'echo' => 0, 367 'hide_empty' => 0, 368 'exclude' => array( $parent, $parent2 ), 369 'exclude_tree' => array( $parent3, $parent4 ), 370 ) ); 371 372 $this->assertContains( '<li class="cat-item cat-item-' . $c . '">', $actual ); 373 374 $this->assertNotContains( '<li class="cat-item cat-item-' . $parent . '">', $actual ); 375 $this->assertNotContains( '<li class="cat-item cat-item-' . $parent2 . '">', $actual ); 376 $this->assertNotContains( '<li class="cat-item cat-item-' . $child . '">', $actual ); 377 $this->assertNotContains( '<li class="cat-item cat-item-' . $child2 . '">', $actual ); 378 379 $this->assertNotContains( '<li class="cat-item cat-item-' . $parent3 . '">', $actual ); 380 $this->assertNotContains( '<li class="cat-item cat-item-' . $parent4 . '">', $actual ); 381 $this->assertNotContains( '<li class="cat-item cat-item-' . $child3 . '">', $actual ); 382 $this->assertNotContains( '<li class="cat-item cat-item-' . $child4 . '">', $actual ); 383 } 310 384 }
Note: See TracChangeset
for help on using the changeset viewer.