Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/monara/public_html/test.athavaneng.com/themes.php on line 99
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 226
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 227
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 228
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 229
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 230
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 231
.
/**
* Events tests.
*
* @package mod_survey
* @copyright 2014 Rajesh Taneja
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_survey\event;
/**
* Events tests class.
*
* @package mod_survey
* @copyright 2014 Rajesh Taneja
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class events_test extends \advanced_testcase {
/**
* Setup.
*/
public function setUp(): void {
$this->resetAfterTest();
}
/**
* Test report downloaded event.
*/
public function test_report_downloaded() {
// There is no proper API to call to generate chapters for a book, so what we are
// doing here is simply making sure that the events returns the right information.
$course = $this->getDataGenerator()->create_course();
$survey = $this->getDataGenerator()->create_module('survey', array('course' => $course->id));
$params = array(
'objectid' => $survey->id,
'context' => \context_module::instance($survey->cmid),
'courseid' => $course->id,
'other' => array('type' => 'xls')
);
$event = \mod_survey\event\report_downloaded::create($params);
// Triggering and capturing the event.
$sink = $this->redirectEvents();
$event->trigger();
$events = $sink->get_events();
$this->assertCount(1, $events);
$event = reset($events);
// Checking that the event contains the expected values.
$this->assertInstanceOf('\mod_survey\event\report_downloaded', $event);
$this->assertEquals(\context_module::instance($survey->cmid), $event->get_context());
$this->assertEquals($survey->id, $event->objectid);
$url = new \moodle_url('/mod/survey/download.php', array('id' => $survey->cmid, 'type' => 'xls'));
$expected = array($course->id, "survey", "download", $url->out(), $survey->id, $survey->cmid);
$this->assertEventLegacyLogData($expected, $event);
$this->assertEventContextNotUsed($event);
}
/**
* Test report viewed event.
*/
public function test_report_viewed() {
// There is no proper API to call to generate chapters for a book, so what we are
// doing here is simply making sure that the events returns the right information.
$course = $this->getDataGenerator()->create_course();
$survey = $this->getDataGenerator()->create_module('survey', array('course' => $course->id));
$params = array(
'objectid' => $survey->id,
'context' => \context_module::instance($survey->cmid),
'courseid' => $course->id
);
$event = \mod_survey\event\report_viewed::create($params);
// Triggering and capturing the event.
$sink = $this->redirectEvents();
$event->trigger();
$events = $sink->get_events();
$this->assertCount(1, $events);
$event = reset($events);
// Checking that the event contains the expected values.
$this->assertInstanceOf('\mod_survey\event\report_viewed', $event);
$this->assertEquals(\context_module::instance($survey->cmid), $event->get_context());
$this->assertEquals($survey->id, $event->objectid);
$expected = array($course->id, "survey", "view report", 'report.php?id=' . $survey->cmid, $survey->id, $survey->cmid);
$this->assertEventLegacyLogData($expected, $event);
$this->assertEventContextNotUsed($event);
}
/**
* Test response submitted event.
*/
public function test_response_submitted() {
// There is no proper API to call to generate chapters for a book, so what we are
// doing here is simply making sure that the events returns the right information.
$course = $this->getDataGenerator()->create_course();
$survey = $this->getDataGenerator()->create_module('survey', array('course' => $course->id));
$params = array(
'context' => \context_module::instance($survey->cmid),
'courseid' => $course->id,
'other' => array('surveyid' => $survey->id)
);
$event = \mod_survey\event\response_submitted::create($params);
// Triggering and capturing the event.
$sink = $this->redirectEvents();
$event->trigger();
$events = $sink->get_events();
$this->assertCount(1, $events);
$event = reset($events);
// Checking that the event contains the expected values.
$this->assertInstanceOf('\mod_survey\event\response_submitted', $event);
$this->assertEquals(\context_module::instance($survey->cmid), $event->get_context());
$this->assertEquals($survey->id, $event->other['surveyid']);
$expected = array($course->id, "survey", "submit", 'view.php?id=' . $survey->cmid, $survey->id, $survey->cmid);
$this->assertEventLegacyLogData($expected, $event);
$this->assertEventContextNotUsed($event);
}
}