Renamed converter factory method to more self-descriptive get_converter()
This commit is contained in:
@@ -59,18 +59,18 @@ class moodle1_converter_test extends UnitTestCase {
|
||||
}
|
||||
|
||||
public function test_convert_factory() {
|
||||
$converter = convert_factory::converter('moodle1', $this->tempdir);
|
||||
$converter = convert_factory::get_converter('moodle1', $this->tempdir);
|
||||
$this->assertIsA($converter, 'moodle1_converter');
|
||||
}
|
||||
|
||||
public function test_stash_storage_not_created() {
|
||||
$converter = convert_factory::converter('moodle1', $this->tempdir);
|
||||
$converter = convert_factory::get_converter('moodle1', $this->tempdir);
|
||||
$this->expectException('moodle1_convert_storage_exception');
|
||||
$converter->set_stash('tempinfo', 12);
|
||||
}
|
||||
|
||||
public function test_stash_requiring_empty_stash() {
|
||||
$converter = convert_factory::converter('moodle1', $this->tempdir);
|
||||
$converter = convert_factory::get_converter('moodle1', $this->tempdir);
|
||||
$converter->create_stash_storage();
|
||||
$converter->set_stash('tempinfo', 12);
|
||||
$this->expectException('moodle1_convert_empty_storage_exception');
|
||||
@@ -85,7 +85,7 @@ class moodle1_converter_test extends UnitTestCase {
|
||||
}
|
||||
|
||||
public function test_stash_storage() {
|
||||
$converter = convert_factory::converter('moodle1', $this->tempdir);
|
||||
$converter = convert_factory::get_converter('moodle1', $this->tempdir);
|
||||
$converter->create_stash_storage();
|
||||
|
||||
// test stashes without itemid
|
||||
@@ -112,7 +112,7 @@ class moodle1_converter_test extends UnitTestCase {
|
||||
}
|
||||
|
||||
public function test_get_contextid() {
|
||||
$converter = convert_factory::converter('moodle1', $this->tempdir);
|
||||
$converter = convert_factory::get_converter('moodle1', $this->tempdir);
|
||||
|
||||
// stash storage must be created in advance
|
||||
$converter->create_stash_storage();
|
||||
@@ -135,7 +135,7 @@ class moodle1_converter_test extends UnitTestCase {
|
||||
}
|
||||
|
||||
public function test_convert_run_convert() {
|
||||
$converter = convert_factory::converter('moodle1', $this->tempdir);
|
||||
$converter = convert_factory::get_converter('moodle1', $this->tempdir);
|
||||
$converter->convert();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ abstract class convert_factory {
|
||||
* @param $tempdir The temp directory to operate on
|
||||
* @return base_converter
|
||||
*/
|
||||
public static function converter($name, $tempdir) {
|
||||
public static function get_converter($name, $tempdir) {
|
||||
global $CFG;
|
||||
|
||||
$name = clean_param($name, PARAM_SAFEDIR);
|
||||
|
||||
@@ -143,7 +143,7 @@ abstract class convert_helper {
|
||||
}
|
||||
|
||||
foreach ($path as $name) {
|
||||
$converter = convert_factory::converter($name, $tempdir);
|
||||
$converter = convert_factory::get_converter($name, $tempdir);
|
||||
$converter->convert();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user