mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-12-03 10:08:33 +01:00
31 lines
556 B
PHP
31 lines
556 B
PHP
|
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
namespace Psl\Tests\Arr;
|
||
|
|
||
|
use PHPUnit\Framework\TestCase;
|
||
|
use Psl\Arr;
|
||
|
use Psl\Collection;
|
||
|
use Psl\Exception;
|
||
|
use Psl\Iter;
|
||
|
|
||
|
class CountTest extends TestCase
|
||
|
{
|
||
|
/**
|
||
|
* @dataProvider provideData
|
||
|
*/
|
||
|
public function testCount(int $expected, array $array): void
|
||
|
{
|
||
|
static::assertSame($expected, Arr\count($array));
|
||
|
}
|
||
|
|
||
|
public function provideData(): iterable
|
||
|
{
|
||
|
yield [0, []];
|
||
|
yield [2, [1, 2]];
|
||
|
yield [1, [null]];
|
||
|
yield [4, [null, null, false, 0]];
|
||
|
}
|
||
|
}
|