Hello,
If you want to tests events in Moodle using PHPUnit, the best method is:
public function test_creationg_event() {
$this->resetAfterTest();
$event_sink = $this->redirectEvents();
$course = $this->getDataGenerator()->create_course();
$events = $event_sink->get_events();
$event_sink->close();
$event = $events[0];
$this->assertInstanceOf('\core\event\course_created', $event);
}
Best regards!
No comments:
Post a Comment