Replies: 1 comment
-
Honestly, I'm not sure you should test the firing of the event (as that will depend on the server anyhow, the wp-cron functionality as is should always work), instead what you should test is the business logic of the cron job itself, and you can do that by just executing the callback function and checking if it does what it needs to do. At least that's the way I'd write the cron test. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm having trouble executing scheduled cron events. Is this supported with WP Pest?
For example, I can schedule an event that should run immediately:
My tests to ensure the event is scheduled succeeds:
However, when I attempt to run it with
do_action('wp', 'wp-cron')
it doesn't fire off. I've also tried hitting the URL without any success usins this function:I'm hoping I'm just doing something wrong and there's a better way to execute the events that I have not yet tried.
Beta Was this translation helpful? Give feedback.
All reactions