diff --git a/lib/classes/hook/manager.php b/lib/classes/hook/manager.php index 4bc1140b442..73a05df13e1 100644 --- a/lib/classes/hook/manager.php +++ b/lib/classes/hook/manager.php @@ -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. * diff --git a/lib/tests/hook/manager_test.php b/lib/tests/hook/manager_test.php index 70f702e761e..e6f2674cd2a 100644 --- a/lib/tests/hook/manager_test.php +++ b/lib/tests/hook/manager_test.php @@ -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. *