MDL-41100 libraries: Moved get_plugin_list_with_file to core_component

This commit is contained in:
Frederic Massart
2013-08-09 11:56:48 +08:00
parent 50ff861263
commit d26ec8a598
4 changed files with 103 additions and 16 deletions
+25
View File
@@ -336,5 +336,30 @@ class core_component_testcase extends advanced_testcase {
);
$this->assertSame($expected, $types);
}
public function test_get_plugin_list_with_file() {
// Force the cache reset.
phpunit_util::reset_all_data();
$this->resetAfterTest(true);
$expected = array('completion', 'log', 'loglive', 'outline', 'participation', 'progress', 'stats');
// Test cold.
$list = core_component::get_plugin_list_with_file('report', 'lib.php', false);
$this->assertEquals($expected, array_keys($list));
// Test hot.
$list = core_component::get_plugin_list_with_file('report', 'lib.php', false);
$this->assertEquals($expected, array_keys($list));
// Test with include.
$list = core_component::get_plugin_list_with_file('report', 'lib.php', true);
$this->assertEquals($expected, array_keys($list));
// Test missing.
$list = core_component::get_plugin_list_with_file('report', 'idontexist.php', true);
$this->assertEquals(array(), array_keys($list));
}
}