Skip to content

Commit 38a107e

Browse files
committed
Fix failing alternate cron test
1 parent 8b57666 commit 38a107e

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

features/cron.feature

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,21 @@ Feature: Manage WP-Cron events and schedules
365365
require:
366366
- alternate-wp-cron.php
367367
"""
368+
And a php.ini file:
369+
"""
370+
error_log = {RUN_DIR}/server.log
371+
log_errors = on
372+
"""
373+
And I launch in the background `wp server --host=localhost --port=8080 --config=php.ini`
374+
And a wp-content/mu-plugins/set_cron_site_url.php file:
375+
"""
376+
<?php
377+
add_filter( 'cron_request', static function ( $cron_request_array ) {
378+
$cron_request_array['url'] = str_replace( 'https://example.com', 'http://localhost:8080', $cron_request_array['url'] );
379+
$cron_request_array['args']['sslverify'] = false;
380+
return $cron_request_array;
381+
} );
382+
"""
368383

369384
When I run `wp eval 'var_export( ALTERNATE_WP_CRON );'`
370385
Then STDOUT should be:
@@ -379,13 +394,13 @@ Feature: Manage WP-Cron events and schedules
379394
"""
380395

381396
When I try `wp cron test`
382-
Then STDERR should contain:
397+
Then STDOUT should contain:
383398
"""
384-
Warning: The ALTERNATE_WP_CRON constant is set to true. WP-Cron spawning is not asynchronous.
399+
Success: WP-Cron spawning is working as expected.
385400
"""
386-
And STDERR should contain:
401+
Then STDERR should contain:
387402
"""
388-
Error: WP-Cron spawn returned HTTP status code: 403 Forbidden
403+
Warning: The ALTERNATE_WP_CRON constant is set to true. WP-Cron spawning is not asynchronous.
389404
"""
390405

391406
Scenario: Listing duplicated cron events

0 commit comments

Comments
 (0)