Changeset 1096 in tests for trunk/tests/filters.php
- Timestamp:
- 10/28/2012 07:26:47 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/filters.php
r909 r1096 241 241 242 242 } 243 244 function _self_removal($tag) { 245 remove_action( $tag, array(&$this, '_self_removal'), 10, 1 ); 246 return $tag; 247 } 248 249 /** 250 * @ticket 21169 251 */ 252 function test_filter_removal_during_filter() { 253 $tag = rand_str(); 254 $a = new MockAction(); 255 $b = new MockAction(); 256 257 add_action( $tag, array(&$a, 'filter_append'), 11, 1 ); 258 add_action( $tag, array(&$b, 'filter_append'), 12, 1 ); 259 add_action( $tag, array(&$this, '_self_removal'), 10, 1 ); 260 261 $result = apply_filters($tag, $tag); 262 $this->assertEquals( 1, $a->get_call_count(), 'priority 11 filters should run after priority 10 empties itself' ); 263 $this->assertEquals( 1, $b->get_call_count(), 'priority 12 filters should run after priority 10 empties itself and priority 11 runs' ); 264 $this->assertEquals( $result, $tag . '_append_append', 'priority 11 and 12 filters should run after priority 10 empties itself' ); 265 } 243 266 }
Note: See TracChangeset
for help on using the changeset viewer.