Skip to content

Commit

Permalink
MDL-67217 unittest: usleep and windows don't get along well
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllaó committed Nov 21, 2019
1 parent e04a73c commit e477e13
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion analytics/tests/fixtures/test_analysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class test_analysis extends \core_analytics\analysis {
*/
public function process_analysable(\core_analytics\analysable $analysable): array {
// Half a second.
usleep(500000);
sleep(1);
return parent::process_analysable($analysable);
}
}
2 changes: 1 addition & 1 deletion analytics/tests/model_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public function test_model_timelimit() {

$this->resetAfterTest(true);

set_config('modeltimelimit', 1, 'analytics');
set_config('modeltimelimit', 2, 'analytics');

$courses = array();
for ($i = 0; $i < 5; $i++) {
Expand Down
4 changes: 2 additions & 2 deletions lib/tests/time_splittings_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public function test_periodic() {
$mostrecentrange = reset($mostrecentrange);

// We wait for the next range to be added.
usleep(1000000);
sleep(1);

// We set the analysable again so the time ranges are recalculated.
$seconds->set_analysable($analysable);
Expand Down Expand Up @@ -344,7 +344,7 @@ public function test_periodic() {
$this->mock_cache_first_analysis_caching($modelid, $analysable->get_id(), end($ranges));

// We wait for the next range to be added.
usleep(1000000);
sleep(1);

// We set the analysable again so the time ranges are recalculated.
$upcomingseconds->set_analysable($analysable);
Expand Down

0 comments on commit e477e13

Please sign in to comment.