3.8.1
This commit is contained in:
49
tests/base/Common/ArrayUtil_Test.php
Normal file
49
tests/base/Common/ArrayUtil_Test.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* PhalApi_App\Common\ArrayUtil_Test
|
||||
*
|
||||
* 针对 ../src/app/Common/ArrayUtil.php App\Common\ArrayUtil 类的PHPUnit单元测试
|
||||
*
|
||||
* @author: dogstar 20191231
|
||||
*/
|
||||
|
||||
namespace tests\Base\Common;
|
||||
use Base\Common\ArrayUtil;
|
||||
|
||||
class PhpUnderControl_BaseCommonArrayUtil_Test extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public $appCommonArrayUtil;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->appCommonArrayUtil = new \Base\Common\ArrayUtil();
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
// 输出本次单元测试所执行的SQL语句
|
||||
// var_dump(\PhalApi\DI()->tracer->getSqls());
|
||||
|
||||
// 输出本次单元测试所涉及的追踪埋点
|
||||
// var_dump(\PhalApi\DI()->tracer->getStack());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @group testTakeKey
|
||||
*/
|
||||
public function testTakeKey()
|
||||
{
|
||||
|
||||
$array = array('name' => 'phpunit', 'age' => 1);
|
||||
$keys = array('name');
|
||||
$rs = $this->appCommonArrayUtil::takeKey($array, $keys);
|
||||
$expect = array('name' => 'phpunit');
|
||||
$this->assertEquals($rs, $expect);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user