Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 74... Línea 74...
74
    /**
74
    /**
75
     * Test get_copy
75
     * Test get_copy
76
     *
76
     *
77
     * @covers \restore_controller::get_copy
77
     * @covers \restore_controller::get_copy
78
     */
78
     */
79
    public function test_restore_controller_get_copy() {
79
    public function test_restore_controller_get_copy(): void {
80
        $copydata = (object)["some" => "copydata"];
80
        $copydata = (object)["some" => "copydata"];
81
        $rc = new \restore_controller(1729, $this->courseid, backup::INTERACTIVE_NO, backup::MODE_COPY,
81
        $rc = new \restore_controller(1729, $this->courseid, backup::INTERACTIVE_NO, backup::MODE_COPY,
82
                $this->userid, backup::TARGET_NEW_COURSE, null, backup::RELEASESESSION_NO, $copydata);
82
                $this->userid, backup::TARGET_NEW_COURSE, null, backup::RELEASESESSION_NO, $copydata);
Línea 83... Línea 83...
83
 
83
 
Línea 87... Línea 87...
87
    /**
87
    /**
88
     * Test instantiating a restore controller for a course copy without providing copy data.
88
     * Test instantiating a restore controller for a course copy without providing copy data.
89
     *
89
     *
90
     * @covers \restore_controller::__construct
90
     * @covers \restore_controller::__construct
91
     */
91
     */
92
    public function test_restore_controller_copy_without_copydata() {
92
    public function test_restore_controller_copy_without_copydata(): void {
93
        $this->expectException(\restore_controller_exception::class);
93
        $this->expectException(\restore_controller_exception::class);
Línea 94... Línea 94...
94
 
94
 
95
        new \restore_controller(1729, $this->courseid, backup::INTERACTIVE_NO, backup::MODE_COPY,
95
        new \restore_controller(1729, $this->courseid, backup::INTERACTIVE_NO, backup::MODE_COPY,
96
                $this->userid, backup::TARGET_NEW_COURSE);
96
                $this->userid, backup::TARGET_NEW_COURSE);
Línea 97... Línea 97...
97
    }
97
    }
98
 
98
 
99
    /*
99
    /*
100
     * test base_setting class
100
     * test base_setting class
101
     */
101
     */
102
    public function test_backup_controller() {
102
    public function test_backup_controller(): void {
103
        // Instantiate non interactive backup_controller
103
        // Instantiate non interactive backup_controller
104
        $bc = new mock_backup_controller(backup::TYPE_1ACTIVITY, $this->moduleid, backup::FORMAT_MOODLE,
104
        $bc = new mock_backup_controller(backup::TYPE_1ACTIVITY, $this->moduleid, backup::FORMAT_MOODLE,
105
            backup::INTERACTIVE_NO, backup::MODE_GENERAL, $this->userid);
105
            backup::INTERACTIVE_NO, backup::MODE_GENERAL, $this->userid);
Línea 118... Línea 118...
118
        $recid = $bc->save_controller();
118
        $recid = $bc->save_controller();
119
        $newbc = mock_backup_controller::load_controller($bc->get_backupid());
119
        $newbc = mock_backup_controller::load_controller($bc->get_backupid());
120
        $this->assertTrue($newbc instanceof backup_controller); // This means checksum and load worked ok
120
        $this->assertTrue($newbc instanceof backup_controller); // This means checksum and load worked ok
121
    }
121
    }
Línea 122... Línea 122...
122
 
122
 
123
    public function test_backup_controller_include_files() {
123
    public function test_backup_controller_include_files(): void {
124
        // A MODE_GENERAL controller - this should include files
124
        // A MODE_GENERAL controller - this should include files
125
        $bc = new mock_backup_controller(backup::TYPE_1ACTIVITY, $this->moduleid, backup::FORMAT_MOODLE,
125
        $bc = new mock_backup_controller(backup::TYPE_1ACTIVITY, $this->moduleid, backup::FORMAT_MOODLE,
126
            backup::INTERACTIVE_NO, backup::MODE_GENERAL, $this->userid);
126
            backup::INTERACTIVE_NO, backup::MODE_GENERAL, $this->userid);
Línea 140... Línea 140...
140
    }
140
    }
Línea 141... Línea 141...
141
 
141
 
142
    /**
142
    /**
143
     * Test set kept roles method.
143
     * Test set kept roles method.
144
     */
144
     */
145
    public function test_backup_controller_set_kept_roles() {
145
    public function test_backup_controller_set_kept_roles(): void {
Línea 146... Línea 146...
146
        $this->expectException(\backup_controller_exception::class);
146
        $this->expectException(\backup_controller_exception::class);
147
 
147
 
148
        // Set up controller as a non-copy operation.
148
        // Set up controller as a non-copy operation.
Línea 153... Línea 153...
153
    }
153
    }
Línea 154... Línea 154...
154
 
154
 
155
    /**
155
    /**
156
     * Tests the restore_controller.
156
     * Tests the restore_controller.
157
     */
157
     */
158
    public function test_restore_controller_is_executing() {
158
    public function test_restore_controller_is_executing(): void {
Línea 159... Línea 159...
159
        global $CFG;
159
        global $CFG;
160
 
160
 
161
        // Make a backup.
161
        // Make a backup.
Línea 200... Línea 200...
200
    }
200
    }
Línea 201... Línea 201...
201
 
201
 
202
    /**
202
    /**
203
     * Test prepare copy method.
203
     * Test prepare copy method.
204
     */
204
     */
205
    public function test_restore_controller_prepare_copy() {
205
    public function test_restore_controller_prepare_copy(): void {
Línea 206... Línea 206...
206
        $this->expectException(\restore_controller_exception::class);
206
        $this->expectException(\restore_controller_exception::class);
Línea 207... Línea 207...
207
 
207
 
Línea 223... Línea 223...
223
    }
223
    }
Línea 224... Línea 224...
224
 
224
 
225
    /**
225
    /**
226
     * Test restore of deadlock causing backup.
226
     * Test restore of deadlock causing backup.
227
     */
227
     */
228
    public function test_restore_of_deadlock_causing_backup() {
228
    public function test_restore_of_deadlock_causing_backup(): void {
229
        global $USER, $CFG;
229
        global $USER, $CFG;
Línea 230... Línea 230...
230
        $this->preventResetByRollback();
230
        $this->preventResetByRollback();
231
 
231