Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 30... Línea 30...
30
 * @copyright  2013 Frédéric Massart
30
 * @copyright  2013 Frédéric Massart
31
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
31
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
32
 */
32
 */
33
class processor_test extends \advanced_testcase {
33
class processor_test extends \advanced_testcase {
Línea 34... Línea 34...
34
 
34
 
35
    public function test_basic() {
35
    public function test_basic(): void {
36
        global $DB;
36
        global $DB;
37
        $this->resetAfterTest(true);
37
        $this->resetAfterTest(true);
Línea 38... Línea 38...
38
        $this->setAdminUser();
38
        $this->setAdminUser();
Línea 57... Línea 57...
57
        $p->execute();
57
        $p->execute();
58
        $this->assertTrue($DB->record_exists('course', array('shortname' => 'c1')));
58
        $this->assertTrue($DB->record_exists('course', array('shortname' => 'c1')));
59
        $this->assertTrue($DB->record_exists('course', array('shortname' => 'c2')));
59
        $this->assertTrue($DB->record_exists('course', array('shortname' => 'c2')));
60
    }
60
    }
Línea 61... Línea 61...
61
 
61
 
62
    public function test_restore_template_course() {
62
    public function test_restore_template_course(): void {
63
        global $DB;
63
        global $DB;
64
        $this->resetAfterTest(true);
64
        $this->resetAfterTest(true);
Línea 65... Línea 65...
65
        $this->setAdminUser();
65
        $this->setAdminUser();
Línea 93... Línea 93...
93
            }
93
            }
94
        }
94
        }
95
        $this->assertTrue($found);
95
        $this->assertTrue($found);
96
    }
96
    }
Línea 97... Línea 97...
97
 
97
 
98
    public function test_restore_restore_file() {
98
    public function test_restore_restore_file(): void {
99
        global $DB;
99
        global $DB;
100
        $this->resetAfterTest(true);
100
        $this->resetAfterTest(true);
Línea 101... Línea 101...
101
        $this->setAdminUser();
101
        $this->setAdminUser();
Línea 130... Línea 130...
130
            }
130
            }
131
        }
131
        }
132
        $this->assertTrue($found);
132
        $this->assertTrue($found);
133
    }
133
    }
Línea 134... Línea 134...
134
 
134
 
135
    public function test_shortname_template() {
135
    public function test_shortname_template(): void {
136
        global $DB;
136
        global $DB;
137
        $this->resetAfterTest(true);
137
        $this->resetAfterTest(true);
Línea 138... Línea 138...
138
        $this->setAdminUser();
138
        $this->setAdminUser();
Línea 156... Línea 156...
156
        $this->assertTrue($DB->record_exists('course', array('idnumber' => 'ID123')));
156
        $this->assertTrue($DB->record_exists('course', array('idnumber' => 'ID123')));
157
        $c = $DB->get_record('course', array('idnumber' => 'ID123'));
157
        $c = $DB->get_record('course', array('idnumber' => 'ID123'));
158
        $this->assertEquals('ID123: Course 1', $c->shortname);
158
        $this->assertEquals('ID123: Course 1', $c->shortname);
159
    }
159
    }
Línea 160... Línea 160...
160
 
160
 
161
    public function test_empty_csv() {
161
    public function test_empty_csv(): void {
Línea 162... Línea 162...
162
        $this->resetAfterTest(true);
162
        $this->resetAfterTest(true);
163
 
163
 
164
        $content = array();
164
        $content = array();
Línea 171... Línea 171...
171
        $options = array('mode' => tool_uploadcourse_processor::MODE_CREATE_NEW);
171
        $options = array('mode' => tool_uploadcourse_processor::MODE_CREATE_NEW);
172
        $this->expectException(\moodle_exception::class);
172
        $this->expectException(\moodle_exception::class);
173
        $p = new tool_uploadcourse_processor($cir, $options, array());
173
        $p = new tool_uploadcourse_processor($cir, $options, array());
174
    }
174
    }
Línea 175... Línea 175...
175
 
175
 
176
    public function test_not_enough_columns() {
176
    public function test_not_enough_columns(): void {
Línea 177... Línea 177...
177
        $this->resetAfterTest(true);
177
        $this->resetAfterTest(true);
178
 
178
 
179
        $content = array(
179
        $content = array(
Línea 189... Línea 189...
189
        $options = array('mode' => tool_uploadcourse_processor::MODE_CREATE_NEW);
189
        $options = array('mode' => tool_uploadcourse_processor::MODE_CREATE_NEW);
190
        $this->expectException(\moodle_exception::class);
190
        $this->expectException(\moodle_exception::class);
191
        $p = new tool_uploadcourse_processor($cir, $options, array());
191
        $p = new tool_uploadcourse_processor($cir, $options, array());
192
    }
192
    }
Línea 193... Línea 193...
193
 
193
 
194
    public function test_preview() {
194
    public function test_preview(): void {
195
        global $DB;
195
        global $DB;
Línea 196... Línea 196...
196
        $this->resetAfterTest(true);
196
        $this->resetAfterTest(true);
197
 
197