MDL-49581 Lesson: Remove high score unit tests.

This commit is contained in:
Stephen Bourget
2015-07-28 17:06:02 -04:00
parent bb685cf3fa
commit 58459ff0f0
-75
View File
@@ -199,81 +199,6 @@ class mod_lesson_events_testcase extends advanced_testcase {
$this->assertEventContextNotUsed($event);
}
/**
* Test the highscore added event.
*
* There is no external API for adding a highscore, so the unit test will simply create
* and trigger the event and ensure the legacy log data is returned as expected.
*/
public function test_highscore_added() {
global $DB;
// Create a highscore.
$newhighscore = new stdClass;
$newhighscore->lessonid = $this->lesson->id;
$newhighscore->userid = 3;
$newhighscore->gradeid = 70;
$newhighscore->nickname = 'noob';
$newhighscore->id = $DB->insert_record('lesson_high_scores', $newhighscore);
// Create a highscore added event.
$event = \mod_lesson\event\highscore_added::create(array(
'objectid' => $newhighscore->id,
'context' => context_module::instance($this->lesson->properties()->cmid),
'courseid' => $this->course->id,
'other' => array(
'lessonid' => $this->lesson->id,
'nickname' => 'noob'
)
));
// Trigger and capture the event.
$sink = $this->redirectEvents();
$event->trigger();
$events = $sink->get_events();
$event = reset($events);
// Check that the event data is valid.
$this->assertInstanceOf('\mod_lesson\event\highscore_added', $event);
$this->assertEquals(context_module::instance($this->lesson->properties()->cmid), $event->get_context());
$expected = array($this->course->id, 'lesson', 'update highscores', 'highscores.php?id=' . $this->lesson->properties()->cmid,
'noob', $this->lesson->properties()->cmid);
$this->assertEventLegacyLogData($expected, $event);
$this->assertEventContextNotUsed($event);
$this->assertDebuggingCalled();
}
/**
* Test the highscores viewed event.
*
* There is no external API for viewing highscores, so the unit test will simply create
* and trigger the event and ensure the legacy log data is returned as expected.
*/
public function test_highscores_viewed() {
// Create a highscore viewed event.
$event = \mod_lesson\event\highscores_viewed::create(array(
'objectid' => $this->lesson->id,
'context' => context_module::instance($this->lesson->properties()->cmid),
'courseid' => $this->course->id
));
// Trigger and capture the event.
$sink = $this->redirectEvents();
$event->trigger();
$events = $sink->get_events();
$event = reset($events);
// Check that the event data is valid.
$this->assertInstanceOf('\mod_lesson\event\highscores_viewed', $event);
$this->assertEquals(context_module::instance($this->lesson->properties()->cmid), $event->get_context());
$expected = array($this->course->id, 'lesson', 'view highscores', 'highscores.php?id=' . $this->lesson->properties()->cmid,
$this->lesson->properties()->name, $this->lesson->properties()->cmid);
$this->assertEventLegacyLogData($expected, $event);
$this->assertEventContextNotUsed($event);
$this->assertDebuggingCalled();
}
/**
* Test the lesson started event.
*/