@@ -27,8 +27,9 @@ public function test_got_mod_rewrite( $expected, $apache_loaded, $filter_value =
2727 // without a framework, we rely on the filter for full control.
2828
2929 if ( null !== $ filter_value ) {
30- add_filter ( 'got_rewrite ' , array ( $ this , 'filter_got_rewrite ' ) );
31- $ this ->temp_filter_value = $ filter_value ;
30+ add_filter ( 'got_rewrite ' , function () use ( $ filter_value ) {
31+ return $ filter_value ;
32+ } );
3233 }
3334
3435 // If we are NOT filtering, we need to be aware of the environment.
@@ -38,11 +39,6 @@ public function test_got_mod_rewrite( $expected, $apache_loaded, $filter_value =
3839 // we use the filter to simulate the different outcomes of the internal check.
3940
4041 $ this ->assertSame ( $ expected , got_mod_rewrite () );
41-
42- if ( null !== $ filter_value ) {
43- remove_filter ( 'got_rewrite ' , array ( $ this , 'filter_got_rewrite ' ) );
44- unset( $ this ->temp_filter_value );
45- }
4642 }
4743
4844 /**
@@ -73,19 +69,4 @@ public function data_got_mod_rewrite() {
7369 ),
7470 );
7571 }
76-
77- /**
78- * Temporary property for filter value.
79- * @var bool
80- */
81- private $ temp_filter_value ;
82-
83- /**
84- * Filter callback for 'got_rewrite'.
85- *
86- * @return bool
87- */
88- public function filter_got_rewrite () {
89- return $ this ->temp_filter_value ;
90- }
9172}
0 commit comments