| Línea 37... |
Línea 37... |
| 37 |
|
37 |
|
| 38 |
public function setUp(): void {
|
38 |
public function setUp(): void {
|
| 39 |
$this->resetAfterTest();
|
39 |
$this->resetAfterTest();
|
| Línea 40... |
Línea 40... |
| 40 |
}
|
40 |
}
|
| 41 |
|
41 |
|
| 42 |
public function test_chapter_created() {
|
42 |
public function test_chapter_created(): void {
|
| Línea 43... |
Línea 43... |
| 43 |
// There is no proper API to call to generate chapters for a book, so what we are
|
43 |
// There is no proper API to call to generate chapters for a book, so what we are
|
| 44 |
// doing here is simply making sure that the events returns the right information.
|
44 |
// doing here is simply making sure that the events returns the right information.
|
| Línea 63... |
Línea 63... |
| 63 |
$this->assertInstanceOf('\mod_book\event\chapter_created', $event);
|
63 |
$this->assertInstanceOf('\mod_book\event\chapter_created', $event);
|
| 64 |
$this->assertEquals(\context_module::instance($book->cmid), $event->get_context());
|
64 |
$this->assertEquals(\context_module::instance($book->cmid), $event->get_context());
|
| 65 |
$this->assertEquals($chapter->id, $event->objectid);
|
65 |
$this->assertEquals($chapter->id, $event->objectid);
|
| 66 |
}
|
66 |
}
|
| Línea 67... |
Línea 67... |
| 67 |
|
67 |
|
| 68 |
public function test_chapter_updated() {
|
68 |
public function test_chapter_updated(): void {
|
| 69 |
// There is no proper API to call to generate chapters for a book, so what we are
|
69 |
// There is no proper API to call to generate chapters for a book, so what we are
|
| Línea 70... |
Línea 70... |
| 70 |
// doing here is simply making sure that the events returns the right information.
|
70 |
// doing here is simply making sure that the events returns the right information.
|
| 71 |
|
71 |
|
| Línea 89... |
Línea 89... |
| 89 |
$this->assertInstanceOf('\mod_book\event\chapter_updated', $event);
|
89 |
$this->assertInstanceOf('\mod_book\event\chapter_updated', $event);
|
| 90 |
$this->assertEquals(\context_module::instance($book->cmid), $event->get_context());
|
90 |
$this->assertEquals(\context_module::instance($book->cmid), $event->get_context());
|
| 91 |
$this->assertEquals($chapter->id, $event->objectid);
|
91 |
$this->assertEquals($chapter->id, $event->objectid);
|
| 92 |
}
|
92 |
}
|
| Línea 93... |
Línea 93... |
| 93 |
|
93 |
|
| 94 |
public function test_chapter_deleted() {
|
94 |
public function test_chapter_deleted(): void {
|
| 95 |
// There is no proper API to call to delete chapters for a book, so what we are
|
95 |
// There is no proper API to call to delete chapters for a book, so what we are
|
| Línea 96... |
Línea 96... |
| 96 |
// doing here is simply making sure that the events returns the right information.
|
96 |
// doing here is simply making sure that the events returns the right information.
|
| 97 |
|
97 |
|
| Línea 117... |
Línea 117... |
| 117 |
$this->assertEquals(\context_module::instance($book->cmid), $event->get_context());
|
117 |
$this->assertEquals(\context_module::instance($book->cmid), $event->get_context());
|
| 118 |
$this->assertEquals($chapter->id, $event->objectid);
|
118 |
$this->assertEquals($chapter->id, $event->objectid);
|
| 119 |
$this->assertEquals($chapter, $event->get_record_snapshot('book_chapters', $chapter->id));
|
119 |
$this->assertEquals($chapter, $event->get_record_snapshot('book_chapters', $chapter->id));
|
| 120 |
}
|
120 |
}
|
| Línea 121... |
Línea 121... |
| 121 |
|
121 |
|
| 122 |
public function test_course_module_instance_list_viewed() {
|
122 |
public function test_course_module_instance_list_viewed(): void {
|
| 123 |
// There is no proper API to call to trigger this event, so what we are
|
123 |
// There is no proper API to call to trigger this event, so what we are
|
| Línea 124... |
Línea 124... |
| 124 |
// doing here is simply making sure that the events returns the right information.
|
124 |
// doing here is simply making sure that the events returns the right information.
|
| 125 |
|
125 |
|
| Línea 139... |
Línea 139... |
| 139 |
// Checking that the event contains the expected values.
|
139 |
// Checking that the event contains the expected values.
|
| 140 |
$this->assertInstanceOf('\mod_book\event\course_module_instance_list_viewed', $event);
|
140 |
$this->assertInstanceOf('\mod_book\event\course_module_instance_list_viewed', $event);
|
| 141 |
$this->assertEquals(\context_course::instance($course->id), $event->get_context());
|
141 |
$this->assertEquals(\context_course::instance($course->id), $event->get_context());
|
| 142 |
}
|
142 |
}
|
| Línea 143... |
Línea 143... |
| 143 |
|
143 |
|
| 144 |
public function test_course_module_viewed() {
|
144 |
public function test_course_module_viewed(): void {
|
| 145 |
// There is no proper API to call to trigger this event, so what we are
|
145 |
// There is no proper API to call to trigger this event, so what we are
|
| Línea 146... |
Línea 146... |
| 146 |
// doing here is simply making sure that the events returns the right information.
|
146 |
// doing here is simply making sure that the events returns the right information.
|
| 147 |
|
147 |
|
| Línea 165... |
Línea 165... |
| 165 |
$this->assertInstanceOf('\mod_book\event\course_module_viewed', $event);
|
165 |
$this->assertInstanceOf('\mod_book\event\course_module_viewed', $event);
|
| 166 |
$this->assertEquals(\context_module::instance($book->cmid), $event->get_context());
|
166 |
$this->assertEquals(\context_module::instance($book->cmid), $event->get_context());
|
| 167 |
$this->assertEquals($book->id, $event->objectid);
|
167 |
$this->assertEquals($book->id, $event->objectid);
|
| 168 |
}
|
168 |
}
|
| Línea 169... |
Línea 169... |
| 169 |
|
169 |
|
| 170 |
public function test_chapter_viewed() {
|
170 |
public function test_chapter_viewed(): void {
|
| 171 |
// There is no proper API to call to trigger this event, so what we are
|
171 |
// There is no proper API to call to trigger this event, so what we are
|
| Línea 172... |
Línea 172... |
| 172 |
// doing here is simply making sure that the events returns the right information.
|
172 |
// doing here is simply making sure that the events returns the right information.
|
| 173 |
|
173 |
|