MDL-78332 core: remove unnecessary hooks reset method

This commit is contained in:
Petr Skoda
2023-05-24 14:35:59 +02:00
parent ac0767cac4
commit 0dcb5c4281
2 changed files with 0 additions and 42 deletions
-24
View File
@@ -89,30 +89,6 @@ final class manager implements
return $instance;
}
/**
* Reset all hook caches. This is intended to be called only
* from the admin/hooks.php page after callback override is changed.
*
* @return void
* @codeCoverageIgnore
*/
public function reset_caches(): void {
if (PHPUNIT_TEST && $this === self::$instance) {
debugging('\core\hook\manager::get_instance()->reset_caches() is not supposed to be called in PHPUnit tests',
DEBUG_DEVELOPER);
return;
}
// WARNING: This will not work when callback overrides are changed
// and multiple web nodes with local cache stores are present - in that
// case admins must purge all caches when tweaking callback overrides.
$cache = \cache::make('core', 'hookcallbacks');
$cache->delete('callbacks');
$cache->delete('deprecations');
$this->init_standard_callbacks();
}
/**
* Returns list of callbacks for given hook name.
*
-18
View File
@@ -56,24 +56,6 @@ class manager_test extends \advanced_testcase {
$this->assertSame(['test_plugin\\hook\\hook'], $testmanager->get_hooks_with_callbacks());
}
/**
* Test reset of test instance.
*
* NOTE: normal hook manger instance cannot be reset in PHPUnit test
* because it may be used to control the test environment itself.
*
* @covers ::reset_caches
* @covers ::init_standard_callbacks
*/
public function test_reset_caches() {
$testmanager = manager::phpunit_get_instance([]);
$this->assertSame([], $testmanager->get_hooks_with_callbacks());
$testmanager->reset_caches();
$manager = manager::get_instance();
$this->assertSame($manager->get_hooks_with_callbacks(), $testmanager->get_hooks_with_callbacks());
}
/**
* Test loading and parsing of callbacks from files.
*