File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,8 @@ public static function init() {
139139 * @return bool
140140 */
141141 private static function use_action_scheduler () {
142- return defined ( 'NEWSPACK_DATA_EVENTS_ACTIONSCHEDULER ' ) && NEWSPACK_DATA_EVENTS_ACTIONSCHEDULER ;
142+ $ use = defined ( 'NEWSPACK_DATA_EVENTS_ACTIONSCHEDULER ' ) && NEWSPACK_DATA_EVENTS_ACTIONSCHEDULER ;
143+ return apply_filters ( 'newspack_data_events_use_action_scheduler_dispatch ' , $ use );
143144 }
144145
145146 /**
Original file line number Diff line number Diff line change @@ -525,12 +525,8 @@ public function test_dispatch_via_action_scheduler() {
525525 $ this ->markTestSkipped ( 'ActionScheduler not available. ' );
526526 }
527527
528- // Enable AS dispatch via constant (off by default).
529- if ( ! defined ( 'NEWSPACK_DATA_EVENTS_ACTIONSCHEDULER ' ) ) {
530- define ( 'NEWSPACK_DATA_EVENTS_ACTIONSCHEDULER ' , true );
531- } elseif ( ! NEWSPACK_DATA_EVENTS_ACTIONSCHEDULER ) {
532- $ this ->markTestSkipped ( 'NEWSPACK_DATA_EVENTS_ACTIONSCHEDULER constant is false and cannot be redefined. ' );
533- }
528+ // Enable AS dispatch via filter.
529+ add_filter ( 'newspack_data_events_use_action_scheduler_dispatch ' , '__return_true ' );
534530
535531 $ action_name = 'test_as_dispatch ' ;
536532 Data_Events::register_action ( $ action_name );
@@ -559,6 +555,8 @@ public function test_dispatch_via_action_scheduler() {
559555 'ARRAY_A '
560556 );
561557 $ this ->assertNotEmpty ( $ pending , 'AS dispatch should schedule pending actions. ' );
558+
559+ remove_filter ( 'newspack_data_events_use_action_scheduler_dispatch ' , '__return_true ' );
562560 }
563561
564562 /**
You can’t perform that action at this time.
0 commit comments