2021-08-29 22:12:50 +08:00
|
|
|
|
<?php
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace HyperfTest\Cases\Helper;
|
|
|
|
|
|
|
|
|
|
|
2021-08-31 22:33:41 +08:00
|
|
|
|
use App\Helpers\ArrayHelper;
|
2021-08-29 22:12:50 +08:00
|
|
|
|
use HyperfTest\HttpTestCase;
|
|
|
|
|
|
|
|
|
|
class ArrayHelperTest extends HttpTestCase
|
|
|
|
|
{
|
|
|
|
|
public function testIsRelationArray()
|
|
|
|
|
{
|
2021-09-04 19:13:25 +08:00
|
|
|
|
$this->assertTrue(!ArrayHelper::isAssociativeArray([1, 2, 3, 4, 5]), '判断是否是关联数组失败1!');
|
|
|
|
|
$this->assertTrue(ArrayHelper::isAssociativeArray([1, 6 => 2, 3, 4, 5]), '判断是否是关联数组失败2!');
|
|
|
|
|
$this->assertTrue(ArrayHelper::isAssociativeArray(['k1' => 'test', 'k2' => 'test2']), '判断是否是关联数组失败3!');
|
2021-08-29 22:12:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|