Skip to content

Commit

Permalink
MDL-75173 completion: Remove ordering from PHPUnit
Browse files Browse the repository at this point in the history
To avoid getting some random errors with Oracle, the order for the
students have been removed from the tests (to check they are there,
regardless the order they are returned, because in that case, the
order is not important).
  • Loading branch information
sarjona committed Oct 18, 2022
1 parent 616e019 commit ecc896f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions completion/tests/api_test.php
Expand Up @@ -283,9 +283,10 @@ public function test_mark_course_completions_activity_criteria() {
$coursecompletionid = \core_completion\api::mark_course_completions_activity_criteria();
$this->assertEquals(0, $coursecompletionid);
$actual = $DB->get_records('course_completions');
$students = [$student1->id, $student2->id];
$this->assertEquals(2, count($actual));
$this->assertEquals($student1->id, reset($actual)->userid);
$this->assertEquals($student2->id, end($actual)->userid);
$this->assertContains(reset($actual)->userid, $students);
$this->assertContains(end($actual)->userid, $students);
}

/**
Expand Down Expand Up @@ -378,9 +379,10 @@ public function test_mark_course_completions_activity_criteria_completion_states
$this->assertEquals($student1->id, reset($actual)->userid);
} else {
// Both students completed a course.
$students = [$student1->id, $student2->id];
$this->assertEquals(2, count($actual));
$this->assertEquals($student1->id, reset($actual)->userid);
$this->assertEquals($student2->id, end($actual)->userid);
$this->assertContains(reset($actual)->userid, $students);
$this->assertContains(end($actual)->userid, $students);
}
}
}
Expand Down

0 comments on commit ecc896f

Please sign in to comment.