Squashed 'libraries/action-scheduler/' content from commit a95f351
git-subtree-dir: libraries/action-scheduler git-subtree-split: a95f351058eada5e5281faa22e5a40865542e839
This commit is contained in:
34
tests/phpunit/helpers/ActionScheduler_Callbacks.php
Normal file
34
tests/phpunit/helpers/ActionScheduler_Callbacks.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ActionScheduler_Callbacks class.
|
||||
*/
|
||||
class ActionScheduler_Callbacks {
|
||||
/**
|
||||
* Scheduled action hook that can be used when we want to simulate an action
|
||||
* with a registered callback.
|
||||
*/
|
||||
const HOOK_WITH_CALLBACK = 'hook_with_callback';
|
||||
|
||||
/**
|
||||
* Setup callbacks for different types of hook.
|
||||
*/
|
||||
public static function add_callbacks() {
|
||||
add_action( self::HOOK_WITH_CALLBACK, array( __CLASS__, 'empty_callback' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove callbacks.
|
||||
*/
|
||||
public static function remove_callbacks() {
|
||||
remove_action( self::HOOK_WITH_CALLBACK, array( __CLASS__, 'empty_callback' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* This stub is used as the callback function for the ActionScheduler_Callbacks::HOOK_WITH_CALLBACK hook.
|
||||
*
|
||||
* Action Scheduler will mark actions as 'failed' if a callback does not exist, this
|
||||
* simply serves to act as the callback for various test scenarios in child classes.
|
||||
*/
|
||||
public static function empty_callback() {}
|
||||
}
|
||||
Reference in New Issue
Block a user