Changeset 52010 for trunk/tests/phpunit/tests/filters.php
- Timestamp:
- 11/04/2021 03:22:47 PM (4 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/filters.php (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/filters.php
r51403 r52010 8 8 class Tests_Filters extends WP_UnitTestCase { 9 9 10 function test_simple_filter() {10 public function test_simple_filter() { 11 11 $a = new MockAction(); 12 12 $tag = __FUNCTION__; … … 26 26 } 27 27 28 function test_remove_filter() {28 public function test_remove_filter() { 29 29 $a = new MockAction(); 30 30 $tag = __FUNCTION__; … … 46 46 } 47 47 48 function test_has_filter() {48 public function test_has_filter() { 49 49 $tag = __FUNCTION__; 50 50 $func = __FUNCTION__ . '_func'; … … 61 61 62 62 // One tag with multiple filters. 63 function test_multiple_filters() {63 public function test_multiple_filters() { 64 64 $a1 = new MockAction(); 65 65 $a2 = new MockAction(); … … 78 78 } 79 79 80 function test_filter_args_1() {80 public function test_filter_args_1() { 81 81 $a = new MockAction(); 82 82 $tag = __FUNCTION__; … … 93 93 } 94 94 95 function test_filter_args_2() {95 public function test_filter_args_2() { 96 96 $a1 = new MockAction(); 97 97 $a2 = new MockAction(); … … 118 118 } 119 119 120 function test_filter_priority() {120 public function test_filter_priority() { 121 121 $a = new MockAction(); 122 122 $tag = __FUNCTION__; … … 149 149 } 150 150 151 function test_all_filter() {151 public function test_all_filter() { 152 152 $a = new MockAction(); 153 153 $tag1 = __FUNCTION__ . '_1'; … … 173 173 } 174 174 175 function test_remove_all_filter() {175 public function test_remove_all_filter() { 176 176 $a = new MockAction(); 177 177 $tag = __FUNCTION__; … … 200 200 * @ticket 20920 201 201 */ 202 function test_remove_all_filters_should_respect_the_priority_argument() {202 public function test_remove_all_filters_should_respect_the_priority_argument() { 203 203 $a = new MockAction(); 204 204 $tag = __FUNCTION__; … … 219 219 * @ticket 9886 220 220 */ 221 function test_filter_ref_array() {221 public function test_filter_ref_array() { 222 222 $obj = new stdClass(); 223 223 $a = new MockAction(); … … 238 238 * @ticket 12723 239 239 */ 240 function test_filter_ref_array_result() {240 public function test_filter_ref_array_result() { 241 241 $obj = new stdClass(); 242 242 $a = new MockAction(); … … 265 265 } 266 266 267 function _self_removal( $tag ) {268 remove_action( $tag, array( $this, '_self_removal' ), 10, 1 );269 return $tag;270 }271 272 267 /** 273 268 * @ticket 29070 274 269 */ 275 function test_has_filter_after_remove_all_filters() {270 public function test_has_filter_after_remove_all_filters() { 276 271 $a = new MockAction(); 277 272 $tag = __FUNCTION__; … … 354 349 */ 355 350 public function test_current_priority() { 356 add_action( 'test_current_priority', array( $this, ' _current_priority_action' ), 99 );351 add_action( 'test_current_priority', array( $this, 'current_priority_action' ), 99 ); 357 352 do_action( 'test_current_priority' ); 358 remove_action( 'test_current_priority', array( $this, ' _current_priority_action' ), 99 );353 remove_action( 'test_current_priority', array( $this, 'current_priority_action' ), 99 ); 359 354 360 355 $this->assertSame( 99, $this->current_priority ); 361 356 } 362 357 363 public function _current_priority_action() {358 public function current_priority_action() { 364 359 global $wp_filter; 365 360 $this->current_priority = $wp_filter[ current_filter() ]->current_priority(); … … 370 365 */ 371 366 public function test_other_priority() { 372 add_action( 'test_current_priority', array( $this, ' _other_priority_action' ), 99 );367 add_action( 'test_current_priority', array( $this, 'other_priority_action' ), 99 ); 373 368 do_action( 'test_current_priority' ); 374 remove_action( 'test_current_priority', array( $this, ' _other_priority_action' ), 99 );369 remove_action( 'test_current_priority', array( $this, 'other_priority_action' ), 99 ); 375 370 376 371 $this->assertFalse( $this->current_priority ); 377 372 } 378 373 379 public function _other_priority_action() {374 public function other_priority_action() { 380 375 global $wp_filter; 381 376 $this->current_priority = $wp_filter['the_content']->current_priority();
Note: See TracChangeset
for help on using the changeset viewer.