Fix tests

This commit is contained in:
Pig Fang 2018-08-19 17:54:00 +08:00
parent 47a0a24a5e
commit e6e989281c
2 changed files with 14 additions and 4 deletions

View File

@ -44,8 +44,8 @@ class PluginControllerTest extends TestCase
->assertNotFound();
// Plugin has config view
plugin('example-plugin')->setEnabled(true);
$this->get('/admin/plugins/config/example-plugin')
plugin('fake-plugin-with-config-view')->setEnabled(true);
$this->get('/admin/plugins/config/fake-plugin-with-config-view')
->assertSuccessful();
}

View File

@ -3,9 +3,13 @@
namespace Tests;
use App\Services\Hook;
use Illuminate\Support\Facades\File;
use Tests\Concerns\GeneratesFakePlugins;
class HookTest extends TestCase
{
use GeneratesFakePlugins;
public function testAddMenuItem()
{
Hook::addMenuItem('user', 0, [
@ -22,9 +26,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('/')
->assertSee('example-plugin/lang/en/locale.js');
->assertSee('fake-plugin-with-i18n/lang/en/locale.js');
File::deleteDirectory(base_path('plugins/fake-plugin-with-i18n'));
}
public function testAddStyleFileToPage()