From f7de3c026de87c87edeca7cec75d6e5777c8d690 Mon Sep 17 00:00:00 2001 From: printempw Date: Thu, 16 Aug 2018 01:26:23 +0800 Subject: [PATCH] Fix ServicesTest/HookTest --- tests/ServicesTest/HookTest.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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()