File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 1616 },
1717 "require-dev" : {
1818 "wp-cli/entity-command" : " ^1.3 || ^2" ,
19+ "wp-cli/server-command" : " ^2.0" ,
1920 "wp-cli/wp-cli-tests" : " ^3.1"
2021 },
2122 "config" : {
Original file line number Diff line number Diff line change @@ -189,6 +189,40 @@ Feature: Manage WP-Cron events and schedules
189189 | name | interval |
190190 | hourly | 3600 |
191191
192+ Scenario : Testing WP-Cron
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:
221+ """
222+ Error:
223+ """
224+ And the {RUN_DIR}/server.log file should not exist
225+
192226 Scenario : Run multiple cron events
193227 When I try `wp cron event run`
194228 Then STDERR should be:
You can’t perform that action at this time.
0 commit comments