From 552d6879094c555f11306bd9564c857ea4f661d2 Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Tue, 18 Oct 2022 08:26:45 +0200 Subject: [PATCH] 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). --- completion/tests/api_test.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/completion/tests/api_test.php b/completion/tests/api_test.php index 4875a69f367..5a92d85e59d 100644 --- a/completion/tests/api_test.php +++ b/completion/tests/api_test.php @@ -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); } } }