diff --git a/features/cron-event.feature b/features/cron-event.feature index 2512d887..06644e02 100644 --- a/features/cron-event.feature +++ b/features/cron-event.feature @@ -158,3 +158,18 @@ Feature: Manage WP Cron events """ Debug: Arguments: """ + + Scenario: Confirm that cron event run in debug mode shows the start of events + When I try `wp cron event run wp_version_check --debug=cron` + Then STDOUT should contain: + """ + Executed the cron event 'wp_version_check' + """ + And STDOUT should contain: + """ + Executed a total of 1 cron event + """ + And STDERR should contain: + """ + Debug: Beginning execution of cron event 'wp_version_check' + """ diff --git a/src/Cron_Event_Command.php b/src/Cron_Event_Command.php index 848850c7..7896396a 100644 --- a/src/Cron_Event_Command.php +++ b/src/Cron_Event_Command.php @@ -243,6 +243,7 @@ public function run( $args, $assoc_args ) { $executed = 0; foreach ( $events as $event ) { + WP_CLI::debug( sprintf( "Beginning execution of cron event '%s'.", $event->hook ), 'cron' ); $start = microtime( true ); $result = self::run_event( $event ); $total = round( microtime( true ) - $start, 3 );