endtoend-test-psl/tests/Psl/Arr/EqualTest.php
2019-12-25 16:56:21 +01:00

59 lines
1.1 KiB
PHP

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