diff --git a/tests/ServicesTest/HookTest.php b/tests/ServicesTest/HookTest.php index e0f14735..de88c438 100644 --- a/tests/ServicesTest/HookTest.php +++ b/tests/ServicesTest/HookTest.php @@ -4,6 +4,8 @@ use App\Services\Hook; class HookTest extends TestCase { + use GeneratesFakePlugins; + public function testAddMenuItem() { Hook::addMenuItem('user', 0, [ @@ -22,9 +24,15 @@ class HookTest extends TestCase public function testRegisterPluginTransScripts() { - Hook::registerPluginTransScripts('example-plugin'); + $this->generateFakePlugin(['name' => 'fake-plugin-with-i18n', 'version' => '0.0.1']); + @mkdir($path = base_path('plugins/fake-plugin-with-i18n/lang/en'), 0755, true); + file_put_contents("$path/locale.js", ''); + + Hook::registerPluginTransScripts('fake-plugin-with-i18n'); $this->get('/') - ->see('example-plugin/lang/en/locale.js'); + ->see('fake-plugin-with-i18n/lang/en/locale.js'); + + File::deleteDirectory(base_path('plugins/fake-plugin-with-i18n')); } public function testAddStyleFileToPage()