fix tests of plugin hook

This commit is contained in:
Pig Fang 2018-07-13 16:10:23 +08:00
parent 4e6478c8f9
commit 4c44fa47cd

View File

@ -12,44 +12,42 @@ class HookTest extends TestCase
'icon' => 'fa-book'
]);
$this->actAs('normal')
->visit('/user')
->see('Go to closet')
->see('/user/closet')
->see('fa-book')
->click('Go to closet')
->seePageIs('/user/closet');
->get('/user')
->assertSee('Go to closet')
->assertSee('/user/closet')
->assertSee('fa-book');
}
public function testRegisterPluginTransScripts()
{
Hook::registerPluginTransScripts('example-plugin');
$this->get('/')
->see('example-plugin/lang/en/locale.js');
->assertSee('example-plugin/lang/en/locale.js');
}
public function testAddStyleFileToPage()
{
Hook::addStyleFileToPage('/style/all');
$this->visit('/')
->see('<link rel="stylesheet" href="/style/all">');
$this->get('/')
->assertSee('<link rel="stylesheet" href="/style/all">');
Hook::addStyleFileToPage('/style/pattern', ['skinlib']);
$this->visit('/')
->dontSee('<link rel="stylesheet" href="/style/pattern">');
$this->visit('/skinlib')
->see('<link rel="stylesheet" href="/style/pattern">');
$this->get('/')
->assertDontSee('<link rel="stylesheet" href="/style/pattern">');
$this->get('/skinlib')
->assertSee('<link rel="stylesheet" href="/style/pattern">');
}
public function testAddScriptFileToPage()
{
Hook::addScriptFileToPage('/script/all');
$this->visit('/')
->see('<script src="/script/all"></script>');
$this->get('/')
->assertSee('<script src="/script/all"></script>');
Hook::addScriptFileToPage('/script/pattern', ['skinlib']);
$this->visit('/')
->dontSee('<script src="/script/pattern"></script>');
$this->visit('/skinlib')
->see('<script src="/script/pattern"></script>');
$this->get('/')
->assertDontSee('<script src="/script/pattern"></script>');
$this->get('/skinlib')
->assertSee('<script src="/script/pattern"></script>');
}
}