Preparations
- in IDE:
- go to Languages & Frameworks → PHP → Debug section of PhpStorm settings dialog
- set Max simultaneous connections setting to 3
- save changes
- in Admin Console:
- go to Configuration → Website → Advanced section
- enable Use Cron to run Scheduled Tasks setting
- save changes
- go to Configuration → Website → Scheduled Tasks section
- disable all scheduled tasks
- pick several tasks, that are executed each minute (update Run Schedule of any other task to make it usable in the test)
- enable picked tasks (Cancel them if they're marked as running currently)
- in IDE:
- replace body of above chosen scheduled tasks with `echo #' . getmypid() . ' - ' . $event . PHP_EOL;
- place breakpoint on foreach ($events_source as $short_name => $event_data) { line in \kScheduledTaskManager::runAll method
- in Terminal (start 2 windows in parallel):
- enable debugging from CLI
- run php tools/cron.php in folder of the project
Test Plan
Goal is to test, that even if both tools/cron.php started with same available scheduled task list they won't execute scheduled tasks, that were processed from parallel process.