Skip to content

Commit

Permalink
MDL-69256 tests: Fix random slow test failures in completion cron
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Mar 23, 2021
1 parent fc335f5 commit cbcf9f6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/tests/completion_daily_task_test.php
Expand Up @@ -114,10 +114,12 @@ public function test_completion_daily_cron() {

// Get s1's completion record from c1.
$s1c1 = $DB->get_record('course_completions', ['userid' => $s1->id, 'course' => $c1->id]);
$this->assertEquals(userdate($now), userdate($s1c1->timeenrolled));
$this->assertGreaterThanOrEqual($now, $s1c1->timeenrolled);
$this->assertLessThanOrEqual(time(), $s1c1->timeenrolled);

// Get s2's completion record from c1.
$s2c1 = $DB->get_record('course_completions', ['userid' => $s2->id, 'course' => $c1->id]);
$this->assertEquals(userdate($now), userdate($s2c1->timeenrolled));
$this->assertGreaterThanOrEqual($now, $s2c1->timeenrolled);
$this->assertLessThanOrEqual(time(), $s2c1->timeenrolled);
}
}

0 comments on commit cbcf9f6

Please sign in to comment.