添加单元测试

main
gzydong 2021-08-29 22:12:50 +08:00
parent c4b811db79
commit 649a90ca0e
2 changed files with 18 additions and 1 deletions

View File

@ -3,7 +3,6 @@ declare(strict_types=1);
namespace App\Helper; namespace App\Helper;
class ArrayHelper class ArrayHelper
{ {
/** /**

View File

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace HyperfTest\Cases\Helper;
use App\Helper\ArrayHelper;
use HyperfTest\HttpTestCase;
class ArrayHelperTest extends HttpTestCase
{
public function testIsRelationArray()
{
$this->assertTrue(!ArrayHelper::isRelationArray([1, 2, 3, 4, 5]), '判断是否是关联数组失败1');
$this->assertTrue(ArrayHelper::isRelationArray([1, 6 => 2, 3, 4, 5]), '判断是否是关联数组失败2');
$this->assertTrue(ArrayHelper::isRelationArray(['k1' => 'test', 'k2' => 'test2']), '判断是否是关联数组失败3');
}
}