MDL-42664 Fix the filter_manager instantiation

For legacy reasons, the $CFG->perfdebug uses values 7 for disabled and 15 for
enabled. Because of this typo, Moodle has always created instance of the slower
performance_measuring_filter_manager instead of the standard filter_manager,
regardless the perfdebug setting.
This commit is contained in:
David Mudrák 2013-11-01 07:36:24 +01:00
parent 5386f0bbfe
commit c928c60718
2 changed files with 16 additions and 1 deletions

View file

@ -660,4 +660,19 @@ class core_filterlib_testcase extends advanced_testcase {
$this->assertEquals('emailprotect,multilang', $CFG->stringfilters);
$this->assertEquals(1, $CFG->filterall);
}
public function test_filter_manager_instance() {
set_config('perfdebug', 7);
filter_manager::reset_caches();
$filterman = filter_manager::instance();
$this->assertInstanceOf('filter_manager', $filterman);
$this->assertNotInstanceOf('performance_measuring_filter_manager', $filterman);
set_config('perfdebug', 15);
filter_manager::reset_caches();
$filterman = filter_manager::instance();
$this->assertInstanceOf('filter_manager', $filterman);
$this->assertInstanceOf('performance_measuring_filter_manager', $filterman);
}
}