diff --git a/features/cron-event.feature b/features/cron-event.feature index a1470b6f..13f37892 100644 --- a/features/cron-event.feature +++ b/features/cron-event.feature @@ -85,3 +85,53 @@ Feature: Manage WP Cron events """ Error: Unscheduling events is only supported from WordPress 4.9.0 onwards. """ + + Scenario: Run cron event with a registered shutdown function + Given a wp-content/mu-plugins/setup_shutdown_function.php file: + """ + add_action('mycron', function() { + breakthings(); + }); + + register_shutdown_function(function() { + $error = error_get_last(); + if ($error['type'] === E_ERROR) { + WP_CLI::line('MY SHUTDOWN FUNCTION'); + } + }); + """ + + When I run `wp cron event schedule mycron now` + And I try `wp cron event run --due-now` + Then STDOUT should contain: + """ + MY SHUTDOWN FUNCTION + """ + + Scenario: Run cron event with a registered shutdown function that logs to a file + Given a wp-content/mu-plugins/setup_shutdown_function_log.php file: + """ +