mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 23:52:49 +08:00
完善测试
This commit is contained in:
@@ -24,7 +24,7 @@ class hookTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testRun()
|
public function testRun()
|
||||||
{
|
{
|
||||||
Hook::add('my_pos', '\tests\thinkphp\library\think\behavior\One');
|
Hook::add('my_pos', '\tests\thinkphp\library\think\behavior\One');
|
||||||
Hook::add('my_pos', '\tests\thinkphp\library\think\behavior\Two');
|
Hook::add('my_pos', ['\tests\thinkphp\library\think\behavior\Two']);
|
||||||
Hook::add('my_pos', '\tests\thinkphp\library\think\behavior\Three', true);
|
Hook::add('my_pos', '\tests\thinkphp\library\think\behavior\Three', true);
|
||||||
$data['id'] = 0;
|
$data['id'] = 0;
|
||||||
$data['name'] = 'thinkphp';
|
$data['name'] = 'thinkphp';
|
||||||
@@ -44,10 +44,13 @@ class hookTest extends \PHPUnit_Framework_TestCase
|
|||||||
'\tests\thinkphp\library\think\behavior\One',
|
'\tests\thinkphp\library\think\behavior\One',
|
||||||
'\tests\thinkphp\library\think\behavior\Three'],
|
'\tests\thinkphp\library\think\behavior\Three'],
|
||||||
]);
|
]);
|
||||||
|
Hook::import(['my_pos' => ['\tests\thinkphp\library\think\behavior\Two']], false);
|
||||||
|
Hook::import(['my_pos' => ['\tests\thinkphp\library\think\behavior\Three', '_overlay' => true]]);
|
||||||
$data['id'] = 0;
|
$data['id'] = 0;
|
||||||
$data['name'] = 'thinkphp';
|
$data['name'] = 'thinkphp';
|
||||||
Hook::listen('my_pos', $data);
|
Hook::listen('my_pos', $data);
|
||||||
$this->assertEquals(3, $data['id']);
|
$this->assertEquals(3, $data['id']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testExec()
|
public function testExec()
|
||||||
|
|||||||
Reference in New Issue
Block a user