MDL-62420 enrol_lti: Fix random unit test fail in privacy
authorAndrew Nicols <andrew@nicols.co.uk>
Mon, 14 May 2018 00:43:15 +0000 (08:43 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Mon, 14 May 2018 00:43:15 +0000 (08:43 +0800)
enrol/lti/tests/privacy_provider_test.php

index 034b683..6484780 100644 (file)
@@ -82,14 +82,12 @@ class enrol_lti_privacy_provider_testcase extends \core_privacy\tests\provider_t
 
         $this->assertCount(2, $contextlist);
 
-        $contextforcourse = $contextlist->current();
-        $context = context_course::instance($this->course->id);
-        $this->assertEquals($context->id, $contextforcourse->id);
-
-        $contextlist->next();
-        $contextforactivity = $contextlist->current();
-        $context = context_module::instance($this->activity->cmid);
-        $this->assertEquals($context->id, $contextforactivity->id);
+        $coursectx = context_course::instance($this->course->id);
+        $activityctx = context_module::instance($this->activity->cmid);
+        $expectedids = [$coursectx->id, $activityctx->id];
+
+        $actualids = $contextlist->get_contextids();
+        $this->assertEquals($expectedids, $actualids, '', 0.0, 10, true);
     }
 
     /**