/** * 测试[Arr::unshift]的功能 * * @dataProvider dataUnshift * @param mixed $key * @param mixed $val */ public function testUnshift($key, $val) { $arr = [uniqid(time()) => uniqid(), uniqid() => uniqid()]; Arr::unshift($arr, $key, $val); $this->assertEquals(true, Arr::get($arr, $key) === $val && array_search($key, $arr) == 0); }