Fix ServicesTest/HookTest

This commit is contained in:
printempw 2018-08-16 01:26:23 +08:00
parent 8aa3416260
commit f7de3c026d

View File

@ -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()