Changeset 63488 for trunk/tests/phpunit/tests/term.php
- Timestamp:
- 09/05/2026 01:39:01 AM (2 months ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/term.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/term.php
r56971 r63488 78 78 // There are 5 posts, all Uncategorized. 79 79 $this->assertSame( '1', $count ); 80 } 81 82 /** 83 * Ensures a queried parent term outside the taxonomy hierarchy counts as the integer 0. 84 * 85 * Every other outcome is a numeric string, so this is the one case where the return 86 * type is not a string at all. 87 * 88 * @ticket 61936 89 * 90 * @covers ::wp_count_terms 91 */ 92 public function test_wp_count_terms_should_return_integer_zero_for_a_parent_outside_the_hierarchy() { 93 register_taxonomy( 'wptests_tax_hierarchical', 'post', array( 'hierarchical' => true ) ); 94 95 $term_id = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax_hierarchical' ) ); 96 $this->assertIsInt( $term_id, 'The term was not created.' ); 97 98 $count = wp_count_terms( 99 array( 100 'taxonomy' => 'wptests_tax_hierarchical', 101 'parent' => 99999, 102 ) 103 ); 104 $this->assertSame( 0, $count, 'Incorrect count for a parent outside the hierarchy.' ); 105 106 $count = wp_count_terms( 107 array( 108 'taxonomy' => 'wptests_tax_hierarchical', 109 'child_of' => 99999, 110 ) 111 ); 112 $this->assertSame( 0, $count, 'Incorrect count for a child_of outside the hierarchy.' ); 80 113 } 81 114
Note:
See TracChangeset
for help on using the changeset viewer.