-
Improvement
-
Resolution: Fixed
-
Minor
-
3.0.6, 3.1.2
-
MOODLE_30_STABLE, MOODLE_31_STABLE
-
MOODLE_30_STABLE, MOODLE_31_STABLE
-
- Run Unit tests, confirm a pass
- Revert the merge of this change
- Run Unit tests, confirm a pass and that that the time is greater than it was with the patch.
PHPUnit makes lots of calls to sleep() to ensure that calls to time() return different numbers. This slows down testings considerably. There are 54 seconds worth of sleep() via 34 calls.
There are complex cards to enable mocking of time() to resolve this issue on a more comprehensive basis.
In all uses of sleep(), what is really desired is that one second has rolled forward.
To reduce that, we wait for the second to roll over. So we now wait for the time() function to return a different answer. This will 1/2 the wait time on average. And worst case example it will be no worse than sleep(1).
There are a number of sleep(2) places that are replaced and will be a performance win regardless.
- will help resolve
-
MDL-43507 phpunit execution is painfully slow
-
- Closed
-