| @@ 31-45 (lines=15) @@ | ||
| 28 | /** |
|
| 29 | * @ticket 30975 |
|
| 30 | */ |
|
| 31 | public function test_category_exists_should_select_oldest_matching_category_when_no_parent_is_specified_1() |
|
| 32 | { |
|
| 33 | // Foo child of c1 is created first. |
|
| 34 | $c1 = self::factory()->category->create(); |
|
| 35 | $c2 = self::factory()->category->create( |
|
| 36 | array( |
|
| 37 | 'name' => 'Foo', |
|
| 38 | 'parent' => $c1, |
|
| 39 | ) |
|
| 40 | ); |
|
| 41 | $c3 = self::factory()->category->create( |
|
| 42 | array( |
|
| 43 | 'name' => 'Foo', |
|
| 44 | ) |
|
| 45 | ); |
|
| 46 | ||
| 47 | $found = category_exists('Foo'); |
|
| 48 | ||
| @@ 55-69 (lines=15) @@ | ||
| 52 | /** |
|
| 53 | * @ticket 30975 |
|
| 54 | */ |
|
| 55 | public function test_category_exists_should_select_oldest_matching_category_when_no_parent_is_specified_2() |
|
| 56 | { |
|
| 57 | // Top-level Foo is created first. |
|
| 58 | $c1 = self::factory()->category->create(); |
|
| 59 | $c2 = self::factory()->category->create( |
|
| 60 | array( |
|
| 61 | 'name' => 'Foo', |
|
| 62 | ) |
|
| 63 | ); |
|
| 64 | $c3 = self::factory()->category->create( |
|
| 65 | array( |
|
| 66 | 'name' => 'Foo', |
|
| 67 | 'parent' => $c1, |
|
| 68 | ) |
|
| 69 | ); |
|
| 70 | ||
| 71 | $found = category_exists('Foo'); |
|
| 72 | ||
| @@ 500-506 (lines=7) @@ | ||
| 497 | /** |
|
| 498 | * @ticket 27123 |
|
| 499 | */ |
|
| 500 | function test_get_terms_child_of() |
|
| 501 | { |
|
| 502 | $parent = self::factory()->category->create(); |
|
| 503 | $child = self::factory()->category->create(array( 'parent' => $parent )); |
|
| 504 | ||
| 505 | $terms = get_terms('category', array( 'child_of' => $parent, 'hide_empty' => false )); |
|
| 506 | $this->assertEquals(1, count($terms)); |
|
| 507 | } |
|
| 508 | ||
| 509 | /** |
|