-
Bug
-
Resolution: Won't Do
-
Minor
-
None
-
2.7.1, 2.8.1
-
MOODLE_27_STABLE, MOODLE_28_STABLE
-
Easy
The Behat task 'And I trigger cron' seems to work just by going to admin/cron.php. This is fine but if you are testing something that uses cron, a common pattern is:
- Set something up
- Trigger cron
- Check that a result happened
- Change a setting
- Trigger cron
- Check that a result happened
The problem is, when Moodle runs tasks (e.g. legacy cron) there are limits to stop them happening too frequently. As a result, the second time Moodle does not run cron tasks e.g. the legacy cron task (it only runs once per minute).
In the Behat run we are probably not really trying to simulate 'what happens if a user runs cron twice within 10 seconds' but 'over a period of time, cron runs twice, each time taking full effect'.
I'm not sure what is the best solution for this - possibly 'And I trigger cron' should automatically reset the next runtime for everything in task_scheduled, before going to the page?
I searched for 'behat cron' and didn't find this issue mentioned already, apologies if this is a duplicate.
- will be (partly) resolved by
-
MDL-53110 Consider deprecating step "And I trigger cron"
-
- Closed
-