Changeset 31026
- Timestamp:
- 01/03/2015 02:22:54 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/category/wpListCategories.php
r31025 r31026 2 2 3 3 /** 4 * @group category4 * @group taxonomy 5 5 */ 6 6 class Tests_Category_WpListCategories extends WP_UnitTestCase { 7 public function test_class() { 8 $c = $this->factory->category->create(); 9 10 $found = wp_list_categories( array( 11 'hide_empty' => false, 12 'echo' => false, 13 ) ); 14 15 $this->assertContains( 'class="cat-item cat-item-' . $c . '"', $found ); 16 } 17 18 public function test_class_containing_current_cat() { 19 $c1 = $this->factory->category->create(); 20 $c2 = $this->factory->category->create(); 21 22 $found = wp_list_categories( array( 23 'hide_empty' => false, 24 'echo' => false, 25 'current_category' => $c2, 26 ) ); 27 28 $this->assertNotRegExp( '/class="[^"]*cat-item-' . $c1 . '[^"]*current-cat[^"]*"/', $found ); 29 $this->assertRegExp( '/class="[^"]*cat-item-' . $c2 . '[^"]*current-cat[^"]*"/', $found ); 30 } 31 32 public function test_class_containing_current_cat_parent() { 33 $c1 = $this->factory->category->create(); 34 $c2 = $this->factory->category->create( array( 35 'parent' => $c1, 36 ) ); 37 38 $found = wp_list_categories( array( 39 'hide_empty' => false, 40 'echo' => false, 41 'current_category' => $c2, 42 ) ); 43 44 $this->assertRegExp( '/class="[^"]*cat-item-' . $c1 . '[^"]*current-cat-parent[^"]*"/', $found ); 45 $this->assertNotRegExp( '/class="[^"]*cat-item-' . $c2 . '[^"]*current-cat-parent[^"]*"/', $found ); 46 } 47 7 48 /** 8 49 * @ticket 16792
Note: See TracChangeset
for help on using the changeset viewer.