Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 36... Línea 36...
36
class lib_test extends \advanced_testcase {
36
class lib_test extends \advanced_testcase {
Línea 37... Línea 37...
37
 
37
 
38
    /**
38
    /**
39
     * Test calendar event provide action open.
39
     * Test calendar event provide action open.
40
     */
40
     */
41
    public function test_workshop_core_calendar_provide_event_action_open() {
41
    public function test_workshop_core_calendar_provide_event_action_open(): void {
42
        $this->resetAfterTest();
42
        $this->resetAfterTest();
Línea 43... Línea 43...
43
        $this->setAdminUser();
43
        $this->setAdminUser();
44
 
44
 
Línea 59... Línea 59...
59
    }
59
    }
Línea 60... Línea 60...
60
 
60
 
61
    /**
61
    /**
62
     * Test calendar event provide action open for a non user.
62
     * Test calendar event provide action open for a non user.
63
     */
63
     */
64
    public function test_workshop_core_calendar_provide_event_action_open_for_non_user() {
64
    public function test_workshop_core_calendar_provide_event_action_open_for_non_user(): void {
Línea 65... Línea 65...
65
        global $CFG;
65
        global $CFG;
66
 
66
 
Línea 85... Línea 85...
85
    }
85
    }
Línea 86... Línea 86...
86
 
86
 
87
    /**
87
    /**
88
     * Test calendar event provide action open when user id is provided.
88
     * Test calendar event provide action open when user id is provided.
89
     */
89
     */
90
    public function test_workshop_core_calendar_provide_event_action_open_for_user() {
90
    public function test_workshop_core_calendar_provide_event_action_open_for_user(): void {
Línea 91... Línea 91...
91
        global $CFG;
91
        global $CFG;
92
 
92
 
Línea 115... Línea 115...
115
    }
115
    }
Línea 116... Línea 116...
116
 
116
 
117
    /**
117
    /**
118
     * Test calendar event provide action closed.
118
     * Test calendar event provide action closed.
119
     */
119
     */
120
    public function test_workshop_core_calendar_provide_event_action_closed() {
120
    public function test_workshop_core_calendar_provide_event_action_closed(): void {
121
        $this->resetAfterTest();
121
        $this->resetAfterTest();
Línea 122... Línea 122...
122
        $this->setAdminUser();
122
        $this->setAdminUser();
123
 
123
 
Línea 137... Línea 137...
137
    }
137
    }
Línea 138... Línea 138...
138
 
138
 
139
    /**
139
    /**
140
     * Test calendar event provide action closed for a non user.
140
     * Test calendar event provide action closed for a non user.
141
     */
141
     */
142
    public function test_workshop_core_calendar_provide_event_action_closed_for_non_user() {
142
    public function test_workshop_core_calendar_provide_event_action_closed_for_non_user(): void {
Línea 143... Línea 143...
143
        global $CFG;
143
        global $CFG;
144
 
144
 
Línea 162... Línea 162...
162
    }
162
    }
Línea 163... Línea 163...
163
 
163
 
164
    /**
164
    /**
165
     * Test calendar event provide action closed when user id is provided.
165
     * Test calendar event provide action closed when user id is provided.
166
     */
166
     */
167
    public function test_workshop_core_calendar_provide_event_action_closed_for_user() {
167
    public function test_workshop_core_calendar_provide_event_action_closed_for_user(): void {
Línea 168... Línea 168...
168
        global $CFG;
168
        global $CFG;
169
 
169
 
Línea 191... Línea 191...
191
    }
191
    }
Línea 192... Línea 192...
192
 
192
 
193
    /**
193
    /**
194
     * Test calendar event action open in future.
194
     * Test calendar event action open in future.
195
     */
195
     */
196
    public function test_workshop_core_calendar_provide_event_action_open_in_future() {
196
    public function test_workshop_core_calendar_provide_event_action_open_in_future(): void {
197
        $this->resetAfterTest();
197
        $this->resetAfterTest();
Línea 198... Línea 198...
198
        $this->setAdminUser();
198
        $this->setAdminUser();
199
 
199
 
Línea 213... Línea 213...
213
    }
213
    }
Línea 214... Línea 214...
214
 
214
 
215
    /**
215
    /**
216
     * Test calendar event action open in future for a non user.
216
     * Test calendar event action open in future for a non user.
217
     */
217
     */
218
    public function test_workshop_core_calendar_provide_event_action_open_in_future_for_non_user() {
218
    public function test_workshop_core_calendar_provide_event_action_open_in_future_for_non_user(): void {
Línea 219... Línea 219...
219
        global $CFG;
219
        global $CFG;
220
 
220
 
Línea 238... Línea 238...
238
    }
238
    }
Línea 239... Línea 239...
239
 
239
 
240
    /**
240
    /**
241
     * Test calendar event action open in future when user id is provided.
241
     * Test calendar event action open in future when user id is provided.
242
     */
242
     */
243
    public function test_workshop_core_calendar_provide_event_action_open_in_future_for_user() {
243
    public function test_workshop_core_calendar_provide_event_action_open_in_future_for_user(): void {
Línea 244... Línea 244...
244
        global $CFG;
244
        global $CFG;
245
 
245
 
Línea 267... Línea 267...
267
    }
267
    }
Línea 268... Línea 268...
268
 
268
 
269
    /**
269
    /**
270
     * Test calendar event with no time specified.
270
     * Test calendar event with no time specified.
271
     */
271
     */
272
    public function test_workshop_core_calendar_provide_event_action_no_time_specified() {
272
    public function test_workshop_core_calendar_provide_event_action_no_time_specified(): void {
273
        $this->resetAfterTest();
273
        $this->resetAfterTest();
Línea 274... Línea 274...
274
        $this->setAdminUser();
274
        $this->setAdminUser();
275
 
275
 
Línea 288... Línea 288...
288
    }
288
    }
Línea 289... Línea 289...
289
 
289
 
290
    /**
290
    /**
291
     * Test calendar event with no time specified for a non user.
291
     * Test calendar event with no time specified for a non user.
292
     */
292
     */
293
    public function test_workshop_core_calendar_provide_event_action_no_time_specified_for_non_user() {
293
    public function test_workshop_core_calendar_provide_event_action_no_time_specified_for_non_user(): void {
Línea 294... Línea 294...
294
        global $CFG;
294
        global $CFG;
295
 
295
 
Línea 309... Línea 309...
309
 
309
 
310
        // Confirm the event is not shown at all.
310
        // Confirm the event is not shown at all.
311
        $this->assertNull($actionevent);
311
        $this->assertNull($actionevent);
Línea 312... Línea 312...
312
    }
312
    }
313
 
313
 
314
    public function test_workshop_core_calendar_provide_event_action_already_completed() {
314
    public function test_workshop_core_calendar_provide_event_action_already_completed(): void {
315
        $this->resetAfterTest();
315
        $this->resetAfterTest();
Línea 316... Línea 316...
316
        set_config('enablecompletion', 1);
316
        set_config('enablecompletion', 1);
Línea 340... Línea 340...
340
 
340
 
341
        // Ensure result was null.
341
        // Ensure result was null.
342
        $this->assertNull($actionevent);
342
        $this->assertNull($actionevent);
Línea 343... Línea 343...
343
    }
343
    }
344
 
344
 
345
    public function test_workshop_core_calendar_provide_event_action_already_completed_for_user() {
345
    public function test_workshop_core_calendar_provide_event_action_already_completed_for_user(): void {
346
        $this->resetAfterTest();
346
        $this->resetAfterTest();
Línea 347... Línea 347...
347
        set_config('enablecompletion', 1);
347
        set_config('enablecompletion', 1);
Línea 398... Línea 398...
398
    }
398
    }
Línea 399... Línea 399...
399
 
399
 
400
    /**
400
    /**
401
     * Test check_updates_since callback.
401
     * Test check_updates_since callback.
402
     */
402
     */
403
    public function test_check_updates_since() {
403
    public function test_check_updates_since(): void {
Línea 404... Línea 404...
404
        global $DB;
404
        global $DB;
405
 
405
 
406
        $this->resetAfterTest();
406
        $this->resetAfterTest();
Línea 494... Línea 494...
494
    }
494
    }
Línea 495... Línea 495...
495
 
495
 
496
    /**
496
    /**
497
     * An unknown event type should not have any limits
497
     * An unknown event type should not have any limits
498
     */
498
     */
499
    public function test_mod_workshop_core_calendar_get_valid_event_timestart_range_unknown_event() {
499
    public function test_mod_workshop_core_calendar_get_valid_event_timestart_range_unknown_event(): void {
500
        global $CFG;
500
        global $CFG;
Línea 501... Línea 501...
501
        require_once($CFG->dirroot . "/calendar/lib.php");
501
        require_once($CFG->dirroot . "/calendar/lib.php");
502
 
502
 
Línea 599... Línea 599...
599
     * @param string $eventtype     The type if the event
599
     * @param string $eventtype     The type if the event
600
     * @param int|null $expectedmin The expected value for min of the valid event range
600
     * @param int|null $expectedmin The expected value for min of the valid event range
601
     * @param int|null $expectedmax The expected value for max of the valid event range
601
     * @param int|null $expectedmax The expected value for max of the valid event range
602
     */
602
     */
603
    public function test_mod_workshop_core_calendar_get_valid_event_timestart_range($submissionstart, $submissionend,
603
    public function test_mod_workshop_core_calendar_get_valid_event_timestart_range($submissionstart, $submissionend,
604
            $assessmentstart, $assessmentend, $eventtype, $expectedmin, $expectedmax) {
604
            $assessmentstart, $assessmentend, $eventtype, $expectedmin, $expectedmax): void {
Línea 605... Línea 605...
605
 
605
 
606
        global $CFG;
606
        global $CFG;
Línea 607... Línea 607...
607
        require_once($CFG->dirroot . '/calendar/lib.php');
607
        require_once($CFG->dirroot . '/calendar/lib.php');
Línea 638... Línea 638...
638
    }
638
    }
Línea 639... Línea 639...
639
 
639
 
640
    /**
640
    /**
641
     * An unknown event type should not change the workshop instance.
641
     * An unknown event type should not change the workshop instance.
642
     */
642
     */
643
    public function test_mod_workshop_core_calendar_event_timestart_updated_unknown_event() {
643
    public function test_mod_workshop_core_calendar_event_timestart_updated_unknown_event(): void {
644
        global $CFG, $DB;
644
        global $CFG, $DB;
Línea 645... Línea 645...
645
        require_once($CFG->dirroot . "/calendar/lib.php");
645
        require_once($CFG->dirroot . "/calendar/lib.php");
646
 
646
 
Línea 723... Línea 723...
723
     * @param string $fieldtoupdate The field that is supposed to be updated.
723
     * @param string $fieldtoupdate The field that is supposed to be updated.
724
     *                              Either of 'submissionstart', 'submissionend', 'assessmentstart' or 'assessmentend'.
724
     *                              Either of 'submissionstart', 'submissionend', 'assessmentstart' or 'assessmentend'.
725
     * @param int $newtime          The new value for the $fieldtoupdate
725
     * @param int $newtime          The new value for the $fieldtoupdate
726
     */
726
     */
727
    public function test_mod_workshop_core_calendar_event_timestart_updated($submissionstart, $submissionend, $assessmentstart,
727
    public function test_mod_workshop_core_calendar_event_timestart_updated($submissionstart, $submissionend, $assessmentstart,
728
            $assessmentend, $eventtype, $fieldtoupdate, $newtime) {
728
            $assessmentend, $eventtype, $fieldtoupdate, $newtime): void {
729
        global $CFG, $DB;
729
        global $CFG, $DB;
730
        require_once($CFG->dirroot . "/calendar/lib.php");
730
        require_once($CFG->dirroot . "/calendar/lib.php");
Línea 731... Línea 731...
731
 
731
 
732
        $this->resetAfterTest(true);
732
        $this->resetAfterTest(true);