From 71e8387a96aadf02091b776eea5ac253febd98cd Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Mon, 8 Apr 2024 09:22:58 +0800 Subject: [PATCH] MDL-81456 core: Move hook fixtures to more appropriate location --- .../hooktest/classes/callbacks.php | 0 .../classes/hook/hook_replacing_callback.php | 0 .../hook/hook_replacing_class_callback.php | 0 .../hooktest/classes/hook_callbacks.php | 0 .../fakeplugins/hooktest/classes/hooks.php | 0 .../fakeplugins/hooktest/db/hooks.php | 0 .../hooktest/db/hooks_nocallbacks.php | 0 .../{ => hook}/fakeplugins/hooktest/lib.php | 0 .../fakeplugins/hooktest/version.php | 0 lib/tests/hook/manager_test.php | 36 +++++++++---------- 10 files changed, 18 insertions(+), 18 deletions(-) rename lib/tests/fixtures/{ => hook}/fakeplugins/hooktest/classes/callbacks.php (100%) rename lib/tests/fixtures/{ => hook}/fakeplugins/hooktest/classes/hook/hook_replacing_callback.php (100%) rename lib/tests/fixtures/{ => hook}/fakeplugins/hooktest/classes/hook/hook_replacing_class_callback.php (100%) rename lib/tests/fixtures/{ => hook}/fakeplugins/hooktest/classes/hook_callbacks.php (100%) rename lib/tests/fixtures/{ => hook}/fakeplugins/hooktest/classes/hooks.php (100%) rename lib/tests/fixtures/{ => hook}/fakeplugins/hooktest/db/hooks.php (100%) rename lib/tests/fixtures/{ => hook}/fakeplugins/hooktest/db/hooks_nocallbacks.php (100%) rename lib/tests/fixtures/{ => hook}/fakeplugins/hooktest/lib.php (100%) rename lib/tests/fixtures/{ => hook}/fakeplugins/hooktest/version.php (100%) diff --git a/lib/tests/fixtures/fakeplugins/hooktest/classes/callbacks.php b/lib/tests/fixtures/hook/fakeplugins/hooktest/classes/callbacks.php similarity index 100% rename from lib/tests/fixtures/fakeplugins/hooktest/classes/callbacks.php rename to lib/tests/fixtures/hook/fakeplugins/hooktest/classes/callbacks.php diff --git a/lib/tests/fixtures/fakeplugins/hooktest/classes/hook/hook_replacing_callback.php b/lib/tests/fixtures/hook/fakeplugins/hooktest/classes/hook/hook_replacing_callback.php similarity index 100% rename from lib/tests/fixtures/fakeplugins/hooktest/classes/hook/hook_replacing_callback.php rename to lib/tests/fixtures/hook/fakeplugins/hooktest/classes/hook/hook_replacing_callback.php diff --git a/lib/tests/fixtures/fakeplugins/hooktest/classes/hook/hook_replacing_class_callback.php b/lib/tests/fixtures/hook/fakeplugins/hooktest/classes/hook/hook_replacing_class_callback.php similarity index 100% rename from lib/tests/fixtures/fakeplugins/hooktest/classes/hook/hook_replacing_class_callback.php rename to lib/tests/fixtures/hook/fakeplugins/hooktest/classes/hook/hook_replacing_class_callback.php diff --git a/lib/tests/fixtures/fakeplugins/hooktest/classes/hook_callbacks.php b/lib/tests/fixtures/hook/fakeplugins/hooktest/classes/hook_callbacks.php similarity index 100% rename from lib/tests/fixtures/fakeplugins/hooktest/classes/hook_callbacks.php rename to lib/tests/fixtures/hook/fakeplugins/hooktest/classes/hook_callbacks.php diff --git a/lib/tests/fixtures/fakeplugins/hooktest/classes/hooks.php b/lib/tests/fixtures/hook/fakeplugins/hooktest/classes/hooks.php similarity index 100% rename from lib/tests/fixtures/fakeplugins/hooktest/classes/hooks.php rename to lib/tests/fixtures/hook/fakeplugins/hooktest/classes/hooks.php diff --git a/lib/tests/fixtures/fakeplugins/hooktest/db/hooks.php b/lib/tests/fixtures/hook/fakeplugins/hooktest/db/hooks.php similarity index 100% rename from lib/tests/fixtures/fakeplugins/hooktest/db/hooks.php rename to lib/tests/fixtures/hook/fakeplugins/hooktest/db/hooks.php diff --git a/lib/tests/fixtures/fakeplugins/hooktest/db/hooks_nocallbacks.php b/lib/tests/fixtures/hook/fakeplugins/hooktest/db/hooks_nocallbacks.php similarity index 100% rename from lib/tests/fixtures/fakeplugins/hooktest/db/hooks_nocallbacks.php rename to lib/tests/fixtures/hook/fakeplugins/hooktest/db/hooks_nocallbacks.php diff --git a/lib/tests/fixtures/fakeplugins/hooktest/lib.php b/lib/tests/fixtures/hook/fakeplugins/hooktest/lib.php similarity index 100% rename from lib/tests/fixtures/fakeplugins/hooktest/lib.php rename to lib/tests/fixtures/hook/fakeplugins/hooktest/lib.php diff --git a/lib/tests/fixtures/fakeplugins/hooktest/version.php b/lib/tests/fixtures/hook/fakeplugins/hooktest/version.php similarity index 100% rename from lib/tests/fixtures/fakeplugins/hooktest/version.php rename to lib/tests/fixtures/hook/fakeplugins/hooktest/version.php diff --git a/lib/tests/hook/manager_test.php b/lib/tests/hook/manager_test.php index 577cc163407..77354b58b8b 100644 --- a/lib/tests/hook/manager_test.php +++ b/lib/tests/hook/manager_test.php @@ -308,8 +308,8 @@ final class manager_test extends \advanced_testcase { protected function setup_hooktest_plugin(): void { global $CFG; - $this->add_mocked_plugintype('fake', "{$CFG->dirroot}/lib/tests/fixtures/fakeplugins"); - $this->add_mocked_plugin('fake', 'hooktest', "{$CFG->dirroot}/lib/tests/fixtures/fakeplugins/hooktest"); + $this->add_mocked_plugintype('fake', "{$CFG->dirroot}/lib/tests/fixtures/hook/fakeplugins"); + $this->add_mocked_plugin('fake', 'hooktest', "{$CFG->dirroot}/lib/tests/fixtures/hook/fakeplugins/hooktest"); } /** @@ -324,8 +324,8 @@ final class manager_test extends \advanced_testcase { public function test_migrated_callback(): void { $this->resetAfterTest(true); // Include plugin hook discovery agent, and the hook that replaces the callback. - require_once(__DIR__ . '/../fixtures/fakeplugins/hooktest/classes/hooks.php'); - require_once(__DIR__ . '/../fixtures/fakeplugins/hooktest/classes/hook/hook_replacing_callback.php'); + require_once(__DIR__ . '/../fixtures/hook/fakeplugins/hooktest/classes/hooks.php'); + require_once(__DIR__ . '/../fixtures/hook/fakeplugins/hooktest/classes/hook/hook_replacing_callback.php'); // Register the fake plugin with the component manager. $this->setup_hooktest_plugin(); @@ -334,7 +334,7 @@ final class manager_test extends \advanced_testcase { manager::class, manager::phpunit_get_instance( [ - 'fake_hooktest' => __DIR__ . '/../fixtures/fakeplugins/hooktest/db/hooks_nocallbacks.php', + 'fake_hooktest' => __DIR__ . '/../fixtures/hook/fakeplugins/hooktest/db/hooks_nocallbacks.php', ], ), ); @@ -365,9 +365,9 @@ final class manager_test extends \advanced_testcase { public function test_migrated_callback_with_replacement(): void { $this->resetAfterTest(true); // Include plugin hook discovery agent, and the hook that replaces the callback, and a hook callback for the hook. - require_once(__DIR__ . '/../fixtures/fakeplugins/hooktest/classes/hooks.php'); - require_once(__DIR__ . '/../fixtures/fakeplugins/hooktest/classes/hook/hook_replacing_callback.php'); - require_once(__DIR__ . '/../fixtures/fakeplugins/hooktest/classes/hook_callbacks.php'); + require_once(__DIR__ . '/../fixtures/hook/fakeplugins/hooktest/classes/hooks.php'); + require_once(__DIR__ . '/../fixtures/hook/fakeplugins/hooktest/classes/hook/hook_replacing_callback.php'); + require_once(__DIR__ . '/../fixtures/hook/fakeplugins/hooktest/classes/hook_callbacks.php'); // Register the fake plugin with the component manager. $this->setup_hooktest_plugin(); @@ -375,7 +375,7 @@ final class manager_test extends \advanced_testcase { di::set( manager::class, manager::phpunit_get_instance([ - 'fake_hooktest' => __DIR__ . '/../fixtures/fakeplugins/hooktest/db/hooks.php', + 'fake_hooktest' => __DIR__ . '/../fixtures/hook/fakeplugins/hooktest/db/hooks.php', ]), ); @@ -399,9 +399,9 @@ final class manager_test extends \advanced_testcase { public function test_migrated_class_callback(): void { $this->resetAfterTest(true); // Include plugin hook discovery agent, the class containing callbacks, and the hook that replaces the class callback. - require_once(__DIR__ . '/../fixtures/fakeplugins/hooktest/classes/callbacks.php'); - require_once(__DIR__ . '/../fixtures/fakeplugins/hooktest/classes/hooks.php'); - require_once(__DIR__ . '/../fixtures/fakeplugins/hooktest/classes/hook/hook_replacing_class_callback.php'); + require_once(__DIR__ . '/../fixtures/hook/fakeplugins/hooktest/classes/callbacks.php'); + require_once(__DIR__ . '/../fixtures/hook/fakeplugins/hooktest/classes/hooks.php'); + require_once(__DIR__ . '/../fixtures/hook/fakeplugins/hooktest/classes/hook/hook_replacing_class_callback.php'); // Register the fake plugin with the component manager. $this->setup_hooktest_plugin(); @@ -409,7 +409,7 @@ final class manager_test extends \advanced_testcase { di::set( manager::class, manager::phpunit_get_instance([ - 'fake_hooktest' => __DIR__ . '/../fixtures/fakeplugins/hooktest/db/hooks_nocallbacks.php', + 'fake_hooktest' => __DIR__ . '/../fixtures/hook/fakeplugins/hooktest/db/hooks_nocallbacks.php', ]), ); @@ -443,10 +443,10 @@ final class manager_test extends \advanced_testcase { $this->resetAfterTest(true); // Include plugin hook discovery agent, the class containing callbacks, the hook that replaces the class callback, // and a hook callback for the new hook. - require_once(__DIR__ . '/../fixtures/fakeplugins/hooktest/classes/callbacks.php'); - require_once(__DIR__ . '/../fixtures/fakeplugins/hooktest/classes/hooks.php'); - require_once(__DIR__ . '/../fixtures/fakeplugins/hooktest/classes/hook/hook_replacing_class_callback.php'); - require_once(__DIR__ . '/../fixtures/fakeplugins/hooktest/classes/hook_callbacks.php'); + require_once(__DIR__ . '/../fixtures/hook/fakeplugins/hooktest/classes/callbacks.php'); + require_once(__DIR__ . '/../fixtures/hook/fakeplugins/hooktest/classes/hooks.php'); + require_once(__DIR__ . '/../fixtures/hook/fakeplugins/hooktest/classes/hook/hook_replacing_class_callback.php'); + require_once(__DIR__ . '/../fixtures/hook/fakeplugins/hooktest/classes/hook_callbacks.php'); // Register the fake plugin with the component manager. $this->setup_hooktest_plugin(); @@ -454,7 +454,7 @@ final class manager_test extends \advanced_testcase { di::set( manager::class, manager::phpunit_get_instance([ - 'fake_hooktest' => __DIR__ . '/../fixtures/fakeplugins/hooktest/db/hooks.php', + 'fake_hooktest' => __DIR__ . '/../fixtures/hook/fakeplugins/hooktest/db/hooks.php', ]), );