2019-12-24 01:52:07 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Psl\Tests\Arr;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
2019-12-25 00:35:14 +01:00
|
|
|
use Psl\Arr;
|
|
|
|
use Psl\Collection;
|
2019-12-24 01:52:07 +01:00
|
|
|
|
|
|
|
class EqualTest extends TestCase
|
|
|
|
{
|
2019-12-25 00:35:14 +01:00
|
|
|
/**
|
|
|
|
* @dataProvider provideData
|
|
|
|
*/
|
|
|
|
public function testEqualReturnsTheExpectedValue(bool $expected, array $array, array $other): void
|
|
|
|
{
|
|
|
|
static::assertSame($expected, Arr\equal($array, $other));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function provideData(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
[
|
|
|
|
true,
|
|
|
|
['foo' => 'bar', 'baz' => 'qux'],
|
|
|
|
['baz' => 'qux', 'foo' => 'bar'],
|
|
|
|
],
|
|
|
|
|
|
|
|
[
|
|
|
|
false,
|
|
|
|
['foo' => 0, 'baz' => 1],
|
|
|
|
['foo' => '0', 'baz' => 1],
|
|
|
|
],
|
|
|
|
|
|
|
|
[
|
|
|
|
true,
|
|
|
|
[],
|
|
|
|
[],
|
|
|
|
],
|
|
|
|
|
|
|
|
[
|
|
|
|
false,
|
|
|
|
[null],
|
|
|
|
[],
|
|
|
|
],
|
|
|
|
|
|
|
|
[
|
|
|
|
false,
|
|
|
|
[new Collection\Vector([])],
|
|
|
|
[new Collection\Vector([])],
|
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
2019-12-24 01:52:07 +01:00
|
|
|
}
|