/** * Test that the assessable_uploaded event is fired when a file submission has been made. */ public function test_assessable_uploaded() { $this->resetAfterTest(); $data = new stdClass(); $plugin = $this->assign->get_submission_plugin_by_type('onenote'); $sink = $this->redirectEvents(); $plugin->save($this->submission, $data); $events = $sink->get_events(); $this->assertCount(2, $events); $event = reset($events); $this->assertInstanceOf('\\assignsubmission_onenote\\event\\assessable_uploaded', $event); $this->assertEquals($this->context->id, $event->contextid); $this->assertEquals($this->submission->id, $event->objectid); $this->assertCount(2, $event->other['pathnamehashes']); $this->assertEquals($this->fi->get_pathnamehash(), $event->other['pathnamehashes'][0]); $this->assertEquals($this->fi2->get_pathnamehash(), $event->other['pathnamehashes'][1]); $expected = new stdClass(); $expected->modulename = 'assign'; $expected->cmid = $this->cm->id; $expected->itemid = $this->submission->id; $expected->courseid = $this->course->id; $expected->userid = $this->user->id; $expected->file = $this->files; $expected->files = $this->files; $expected->pathnamehashes = array($this->fi->get_pathnamehash(), $this->fi2->get_pathnamehash()); $this->assertEventLegacyData($expected, $event); $this->assertEventContextNotUsed($event); }