Changeset 53803 for trunk/tests/phpunit/tests/filters.php
- Timestamp:
- 07/31/2022 02:18:36 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/filters.php
r53802 r53803 151 151 } 152 152 153 /** 154 * @covers ::did_filter 155 */ 156 public function test_did_filter() { 157 $tag1 = 'filter1'; 158 $tag2 = 'filter2'; 159 $val = __FUNCTION__ . '_val'; 160 161 // Apply filter $tag1 but not $tag2. 162 apply_filters( $tag1, $val ); 163 $this->assertSame( 1, did_filter( $tag1 ) ); 164 $this->assertSame( 0, did_filter( $tag2 ) ); 165 166 // Apply filter $tag2 10 times. 167 $count = 10; 168 for ( $i = 0; $i < $count; $i++ ) { 169 apply_filters( $tag2, $val ); 170 } 171 172 // $tag1's count hasn't changed, $tag2 should be correct. 173 $this->assertSame( 1, did_filter( $tag1 ) ); 174 $this->assertSame( $count, did_filter( $tag2 ) ); 175 176 } 177 153 178 public function test_all_filter() { 154 179 $a = new MockAction();
Note: See TracChangeset
for help on using the changeset viewer.