Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 147... Línea 147...
147
    /**
147
    /**
148
     * Test process form data with invalid data.
148
     * Test process form data with invalid data.
149
     *
149
     *
150
     * @covers ::process_formdata
150
     * @covers ::process_formdata
151
     */
151
     */
152
    public function test_process_formdata_missing_fields() {
152
    public function test_process_formdata_missing_fields(): void {
153
        $this->expectException(\moodle_exception::class);
153
        $this->expectException(\moodle_exception::class);
154
        \copy_helper::process_formdata(new \stdClass);
154
        \copy_helper::process_formdata(new \stdClass);
155
    }
155
    }
Línea 156... Línea 156...
156
 
156
 
157
    /**
157
    /**
158
     * Test processing form data.
158
     * Test processing form data.
159
     *
159
     *
160
     * @covers ::process_formdata
160
     * @covers ::process_formdata
161
     */
161
     */
162
    public function test_process_formdata() {
162
    public function test_process_formdata(): void {
163
        $validformdata = [
163
        $validformdata = [
164
            'courseid' => 1729,
164
            'courseid' => 1729,
165
            'fullname' => 'Taxicab Numbers',
165
            'fullname' => 'Taxicab Numbers',
166
            'shortname' => 'Taxi101',
166
            'shortname' => 'Taxi101',
Línea 193... Línea 193...
193
    /**
193
    /**
194
     * Test orphaned controller cleanup.
194
     * Test orphaned controller cleanup.
195
     *
195
     *
196
     * @covers ::cleanup_orphaned_copy_controllers
196
     * @covers ::cleanup_orphaned_copy_controllers
197
     */
197
     */
198
    public function test_cleanup_orphaned_copy_controllers() {
198
    public function test_cleanup_orphaned_copy_controllers(): void {
199
        global $DB;
199
        global $DB;
Línea 200... Línea 200...
200
 
200
 
201
        // Mock up the form data.
201
        // Mock up the form data.
202
        $formdata = new \stdClass;
202
        $formdata = new \stdClass;
Línea 287... Línea 287...
287
    /**
287
    /**
288
     * Test creating a course copy.
288
     * Test creating a course copy.
289
     *
289
     *
290
     * @covers ::create_copy
290
     * @covers ::create_copy
291
     */
291
     */
292
    public function test_create_copy() {
292
    public function test_create_copy(): void {
Línea 293... Línea 293...
293
 
293
 
294
        // Mock up the form data.
294
        // Mock up the form data.
295
        $formdata = new \stdClass;
295
        $formdata = new \stdClass;
296
        $formdata->courseid = $this->course->id;
296
        $formdata->courseid = $this->course->id;
Línea 340... Línea 340...
340
    /**
340
    /**
341
     * Test getting the current copies.
341
     * Test getting the current copies.
342
     *
342
     *
343
     * @covers ::get_copies
343
     * @covers ::get_copies
344
     */
344
     */
345
    public function test_get_copies() {
345
    public function test_get_copies(): void {
346
        global $USER;
346
        global $USER;
Línea 347... Línea 347...
347
 
347
 
348
        // Mock up the form data.
348
        // Mock up the form data.
349
        $formdata = new \stdClass;
349
        $formdata = new \stdClass;
Línea 414... Línea 414...
414
    /**
414
    /**
415
     * Test getting the current copies when they are in an invalid state.
415
     * Test getting the current copies when they are in an invalid state.
416
     *
416
     *
417
     * @covers ::get_copies
417
     * @covers ::get_copies
418
     */
418
     */
419
    public function test_get_copies_invalid_state() {
419
    public function test_get_copies_invalid_state(): void {
420
        global $DB, $USER;
420
        global $DB, $USER;
Línea 421... Línea 421...
421
 
421
 
422
        // Mock up the form data.
422
        // Mock up the form data.
423
        $formdata = new \stdClass;
423
        $formdata = new \stdClass;
Línea 473... Línea 473...
473
    /**
473
    /**
474
     * Test getting the current copies for specific course.
474
     * Test getting the current copies for specific course.
475
     *
475
     *
476
     * @covers ::get_copies
476
     * @covers ::get_copies
477
     */
477
     */
478
    public function test_get_copies_course() {
478
    public function test_get_copies_course(): void {
479
        global $USER;
479
        global $USER;
Línea 480... Línea 480...
480
 
480
 
481
        // Mock up the form data.
481
        // Mock up the form data.
482
        $formdata = new \stdClass;
482
        $formdata = new \stdClass;
Línea 505... Línea 505...
505
    /**
505
    /**
506
     * Test getting the current copies if course has been deleted.
506
     * Test getting the current copies if course has been deleted.
507
     *
507
     *
508
     * @covers ::get_copies
508
     * @covers ::get_copies
509
     */
509
     */
510
    public function test_get_copies_course_deleted() {
510
    public function test_get_copies_course_deleted(): void {
511
        global $USER;
511
        global $USER;
Línea 512... Línea 512...
512
 
512
 
513
        // Mock up the form data.
513
        // Mock up the form data.
514
        $formdata = new \stdClass;
514
        $formdata = new \stdClass;
Línea 537... Línea 537...
537
    }
537
    }
Línea 538... Línea 538...
538
 
538
 
539
    /**
539
    /**
540
     * Test course copy.
540
     * Test course copy.
541
     */
541
     */
542
    public function test_course_copy() {
542
    public function test_course_copy(): void {
Línea 543... Línea 543...
543
        global $DB;
543
        global $DB;
544
 
544
 
545
        // Mock up the form data.
545
        // Mock up the form data.
Línea 614... Línea 614...
614
    }
614
    }
Línea 615... Línea 615...
615
 
615
 
616
    /**
616
    /**
617
     * Test course copy, not including any users (or data).
617
     * Test course copy, not including any users (or data).
618
     */
618
     */
619
    public function test_course_copy_no_users() {
619
    public function test_course_copy_no_users(): void {
Línea 620... Línea 620...
620
        global $DB;
620
        global $DB;
621
 
621
 
622
        // Mock up the form data.
622
        // Mock up the form data.
Línea 683... Línea 683...
683
    }
683
    }
Línea 684... Línea 684...
684
 
684
 
685
    /**
685
    /**
686
     * Test course copy, including students and their data.
686
     * Test course copy, including students and their data.
687
     */
687
     */
688
    public function test_course_copy_students_data() {
688
    public function test_course_copy_students_data(): void {
Línea 689... Línea 689...
689
        global $DB;
689
        global $DB;
690
 
690
 
691
        // Mock up the form data.
691
        // Mock up the form data.
Línea 752... Línea 752...
752
    }
752
    }
Línea 753... Línea 753...
753
 
753
 
754
    /**
754
    /**
755
     * Test course copy, not including any users (or data).
755
     * Test course copy, not including any users (or data).
756
     */
756
     */
757
    public function test_course_copy_no_data() {
757
    public function test_course_copy_no_data(): void {
Línea 758... Línea 758...
758
        global $DB;
758
        global $DB;
759
 
759
 
760
        // Mock up the form data.
760
        // Mock up the form data.
Línea 820... Línea 820...
820
    }
820
    }
Línea 821... Línea 821...
821
 
821
 
822
    /**
822
    /**
823
     * Test instantiation with incomplete formdata.
823
     * Test instantiation with incomplete formdata.
824
     */
824
     */
825
    public function test_malformed_instantiation() {
825
    public function test_malformed_instantiation(): void {
826
        // Mock up the form data, missing things so we get an exception.
826
        // Mock up the form data, missing things so we get an exception.
827
        $formdata = new \stdClass;
827
        $formdata = new \stdClass;
828
        $formdata->courseid = $this->course->id;
828
        $formdata->courseid = $this->course->id;
829
        $formdata->fullname = 'copy course';
829
        $formdata->fullname = 'copy course';