endtoend-test-psl/tests/Psl/Arr/EqualTest.php
2019-12-25 19:46:58 +01:00

56 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace Psl\Tests\Arr;
use PHPUnit\Framework\TestCase;
use Psl\Arr;
use Psl\Collection;
class EqualTest extends TestCase
{
/**
* @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([])],
],
];
}
}