MDL-75173 completion: Remove ordering from PHPUnit

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).
This commit is contained in:
Sara Arjona
2022-10-18 08:37:57 +02:00
parent 616e01911e
commit ecc896f4b4
+6 -4
View File
@@ -283,9 +283,10 @@ class api_test extends \advanced_testcase {
$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);
}
/**
@@ -378,9 +379,10 @@ class api_test extends \advanced_testcase {
$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);
}
}
}