@@ -2,7 +2,7 @@ Feature: Manage WP-Cron events and schedules
22
33 Background :
44 Given a WP install
5- And I run `wp config set DISABLE_WP_CRON false --raw --type=constant --anchor='// ** MySQL settings - You can get this info from your web host ** //' `
5+ And I run `wp config set DISABLE_WP_CRON false --raw --type=constant --anchor="if ( ! defined( 'DISABLE_WP_CRON' ) )" `
66
77 Scenario : Scheduling and then deleting an event
88 When I run `wp cron event schedule wp_cli_test_event_1 '+1 hour 5 minutes' --0=banana`
@@ -190,11 +190,38 @@ Feature: Manage WP-Cron events and schedules
190190 | hourly | 3600 |
191191
192192 Scenario : Testing WP-Cron
193- When I try `wp cron test`
194- Then STDERR should not contain:
193+ Given a php.ini file:
194+ """
195+ error_log = {RUN_DIR}/server.log
196+ log_errors = on
197+ """
198+ And I launch in the background `wp server --host=localhost --port=8080 --config=php.ini`
199+ And a wp-content/mu-plugins/set_cron_site_url.php file:
200+ """
201+ <?php
202+ add_filter( 'cron_request', static function ( $cron_request_array ) {
203+ $cron_request_array['url'] = 'http://localhost:8080';
204+ $cron_request_array['args']['sslverify'] = false;
205+ return $cron_request_array;
206+ } );
207+ """
208+
209+ When I run `wp cron event schedule wp_cli_test_event_1 '+1 hour 5 minutes' --0=banana`
210+ Then STDOUT should contain:
211+ """
212+ Success: Scheduled event with hook 'wp_cli_test_event_1'
213+ """
214+
215+ When I run `wp cron test`
216+ Then STDOUT should contain:
217+ """
218+ Success: WP-Cron spawning is working as expected.
219+ """
220+ And STDERR should not contain:
195221 """
196222 Error:
197223 """
224+ And the {RUN_DIR}/server.log file should not exist
198225
199226 Scenario : Run multiple cron events
200227 When I try `wp cron event run`
0 commit comments