MDL-40697 mod_*: fixed unit tests so they pass
authorMark Nelson <markn@moodle.com>
Thu, 25 Sep 2014 01:36:17 +0000 (18:36 -0700)
committerMark Nelson <markn@moodle.com>
Wed, 8 Oct 2014 02:08:35 +0000 (19:08 -0700)
mod/assign/tests/events_test.php
mod/quiz/tests/events_test.php
mod/scorm/tests/events_test.php

index 7dfe839..e182212 100644 (file)
@@ -485,8 +485,8 @@ class assign_events_testcase extends mod_assign_base_testcase {
         $grade = $assign->get_user_grade($this->students[0]->id, false, 0);
 
         $events = $sink->get_events();
-        $this->assertCount(1, $events);
-        $event = reset($events);
+        $this->assertCount(3, $events);
+        $event = $events[2];
         $this->assertInstanceOf('\mod_assign\event\submission_graded', $event);
         $this->assertEquals($assign->get_context(), $event->get_context());
         $this->assertEquals($grade->id, $event->objectid);
@@ -514,8 +514,8 @@ class assign_events_testcase extends mod_assign_base_testcase {
         $this->assertEquals('60.0', $grade->grade);
 
         $events = $sink->get_events();
-        $this->assertCount(1, $events);
-        $event = reset($events);
+        $this->assertCount(3, $events);
+        $event = $events[2];
         $this->assertInstanceOf('\mod_assign\event\submission_graded', $event);
         $this->assertEquals($assign->get_context(), $event->get_context());
         $this->assertEquals($grade->id, $event->objectid);
@@ -540,8 +540,8 @@ class assign_events_testcase extends mod_assign_base_testcase {
         $this->assertEquals('50.0', $grade->grade);
         $events = $sink->get_events();
 
-        $this->assertCount(1, $events);
-        $event = reset($events);
+        $this->assertCount(3, $events);
+        $event = $events[2];
         $this->assertInstanceOf('\mod_assign\event\submission_graded', $event);
         $this->assertEquals($assign->get_context(), $event->get_context());
         $this->assertEquals($grade->id, $event->objectid);
index 2f92237..59d8139 100644 (file)
@@ -96,8 +96,8 @@ class mod_quiz_events_testcase extends advanced_testcase {
         $sink->close();
 
         // Validate the event.
-        $this->assertCount(1, $events);
-        $event = $events[0];
+        $this->assertCount(3, $events);
+        $event = $events[2];
         $this->assertInstanceOf('\mod_quiz\event\attempt_submitted', $event);
         $this->assertEquals('quiz_attempts', $event->objecttable);
         $this->assertEquals($quizobj->get_context(), $event->get_context());
index 97ee85e..48a80a9 100644 (file)
@@ -71,7 +71,7 @@ class mod_scorm_event_testcase extends advanced_testcase {
         $event = reset($events);
 
         // Verify data.
-        $this->assertCount(1, $events);
+        $this->assertCount(3, $events);
         $this->assertInstanceOf('\mod_scorm\event\attempt_deleted', $event);
         $this->assertEquals($USER->id, $event->userid);
         $this->assertEquals(context_module::instance($this->eventcm->id), $event->get_context());