Changeset 56609 for trunk/tests/phpunit/tests/hooks/removeAllFilters.php
- Timestamp:
- 09/18/2023 12:39:18 PM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/hooks/removeAllFilters.php
r53804 r56609 19 19 20 20 $hook->remove_all_filters(); 21 $this->check_priority_non_existent( $hook, $priority ); 21 22 22 23 $this->assertFalse( $hook->has_filters() ); … … 35 36 36 37 $hook->remove_all_filters( $priority ); 38 $this->check_priority_non_existent( $hook, $priority ); 37 39 38 40 $this->assertFalse( $hook->has_filter( $hook_name, $callback_one ) ); 39 41 $this->assertTrue( $hook->has_filters() ); 40 42 $this->assertSame( $priority + 1, $hook->has_filter( $hook_name, $callback_two ) ); 43 $this->check_priority_exists( $hook, $priority + 1 ); 44 } 45 46 protected function check_priority_non_existent( $hook, $priority ) { 47 $priorities = $this->get_priorities( $hook ); 48 49 $this->assertNotContains( $priority, $priorities ); 50 } 51 52 protected function check_priority_exists( $hook, $priority ) { 53 $priorities = $this->get_priorities( $hook ); 54 55 $this->assertContains( $priority, $priorities ); 56 } 57 protected function get_priorities( $hook ) { 58 $reflection = new ReflectionClass( $hook ); 59 $reflection_property = $reflection->getProperty( 'priorities' ); 60 $reflection_property->setAccessible( true ); 61 62 return $reflection_property->getValue( $hook ); 41 63 } 42 64 }
Note: See TracChangeset
for help on using the changeset viewer.