Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 41... Línea 41...
41
    }
41
    }
Línea 42... Línea 42...
42
 
42
 
43
    /**
43
    /**
44
     * Test the course category created event.
44
     * Test the course category created event.
45
     */
45
     */
46
    public function test_course_category_created() {
46
    public function test_course_category_created(): void {
47
        // Trigger and capture the event.
47
        // Trigger and capture the event.
48
        $sink = $this->redirectEvents();
48
        $sink = $this->redirectEvents();
49
        $category = $this->getDataGenerator()->create_category();
49
        $category = $this->getDataGenerator()->create_category();
50
        $events = $sink->get_events();
50
        $events = $sink->get_events();
Línea 59... Línea 59...
59
    }
59
    }
Línea 60... Línea 60...
60
 
60
 
61
    /**
61
    /**
62
     * Test the course category updated event.
62
     * Test the course category updated event.
63
     */
63
     */
64
    public function test_course_category_updated() {
64
    public function test_course_category_updated(): void {
65
        // Create a category.
65
        // Create a category.
Línea 66... Línea 66...
66
        $category = $this->getDataGenerator()->create_category();
66
        $category = $this->getDataGenerator()->create_category();
67
 
67
 
Línea 141... Línea 141...
141
     * Test the email failed event.
141
     * Test the email failed event.
142
     *
142
     *
143
     * It's not possible to use the moodle API to simulate the failure of sending
143
     * It's not possible to use the moodle API to simulate the failure of sending
144
     * an email, so here we simply create the event and trigger it.
144
     * an email, so here we simply create the event and trigger it.
145
     */
145
     */
146
    public function test_email_failed() {
146
    public function test_email_failed(): void {
147
        // Trigger event for failing to send email.
147
        // Trigger event for failing to send email.
148
        $event = \core\event\email_failed::create(array(
148
        $event = \core\event\email_failed::create(array(
149
            'context' => \context_system::instance(),
149
            'context' => \context_system::instance(),
150
            'userid' => 1,
150
            'userid' => 1,
151
            'relateduserid' => 2,
151
            'relateduserid' => 2,
Línea 168... Línea 168...
168
    }
168
    }
Línea 169... Línea 169...
169
 
169
 
170
    /**
170
    /**
171
     * There is no api involved so the best we can do is test legacy data by triggering event manually.
171
     * There is no api involved so the best we can do is test legacy data by triggering event manually.
172
     */
172
     */
Línea 173... Línea 173...
173
    public function test_course_user_report_viewed() {
173
    public function test_course_user_report_viewed(): void {
174
 
174
 
175
        $user = $this->getDataGenerator()->create_user();
175
        $user = $this->getDataGenerator()->create_user();
Línea 195... Línea 195...
195
    }
195
    }
Línea 196... Línea 196...
196
 
196
 
197
    /**
197
    /**
198
     * There is no api involved so the best we can do is test legacy data by triggering event manually.
198
     * There is no api involved so the best we can do is test legacy data by triggering event manually.
199
     */
199
     */
Línea 200... Línea 200...
200
    public function test_course_viewed() {
200
    public function test_course_viewed(): void {
201
 
201
 
202
        $user = $this->getDataGenerator()->create_user();
202
        $user = $this->getDataGenerator()->create_user();
Línea 241... Línea 241...
241
        $restored = \core\event\base::restore($loggeddata, array('origin' => 'web', 'ip' => '127.0.0.1'));
241
        $restored = \core\event\base::restore($loggeddata, array('origin' => 'web', 'ip' => '127.0.0.1'));
242
        $this->assertInstanceOf('\core\event\course_viewed', $restored);
242
        $this->assertInstanceOf('\core\event\course_viewed', $restored);
243
        $this->assertNull($restored->get_url());
243
        $this->assertNull($restored->get_url());
244
    }
244
    }
Línea 245... Línea 245...
245
 
245
 
246
    public function test_recent_capability_viewed() {
246
    public function test_recent_capability_viewed(): void {
Línea 247... Línea 247...
247
        $this->resetAfterTest();
247
        $this->resetAfterTest();
248
 
248
 
249
        $this->setAdminUser();
249
        $this->setAdminUser();
Línea 264... Línea 264...
264
        $url = new \moodle_url('/course/recent.php', array('id' => $course->id));
264
        $url = new \moodle_url('/course/recent.php', array('id' => $course->id));
265
        $this->assertEquals($url, $event->get_url());
265
        $this->assertEquals($url, $event->get_url());
266
        $event->get_name();
266
        $event->get_name();
267
    }
267
    }
Línea 268... Línea 268...
268
 
268
 
269
    public function test_user_profile_viewed() {
269
    public function test_user_profile_viewed(): void {
270
        $this->resetAfterTest();
270
        $this->resetAfterTest();
Línea 271... Línea 271...
271
        $this->setAdminUser();
271
        $this->setAdminUser();
272
 
272
 
Línea 314... Línea 314...
314
    }
314
    }
Línea 315... Línea 315...
315
 
315
 
316
    /**
316
    /**
317
     * There is no API associated with this event, so we will just test standard features.
317
     * There is no API associated with this event, so we will just test standard features.
318
     */
318
     */
319
    public function test_grade_viewed() {
319
    public function test_grade_viewed(): void {
320
        $this->resetAfterTest();
320
        $this->resetAfterTest();
Línea 321... Línea 321...
321
        $this->setAdminUser();
321
        $this->setAdminUser();
322
 
322
 
Línea 345... Línea 345...
345
    }
345
    }
Línea 346... Línea 346...
346
 
346
 
347
    /**
347
    /**
348
     * Test the database text field content replaced event.
348
     * Test the database text field content replaced event.
349
     */
349
     */
350
    public function test_database_text_field_content_replaced() {
350
    public function test_database_text_field_content_replaced(): void {
Línea 351... Línea 351...
351
        global $CFG;
351
        global $CFG;
Línea 352... Línea 352...
352
 
352