Pinq\Tests\Integration\Traversable\IndexByTest::testThatIndexByDuplicateKeyWithForeachOnlyReturnsFirstAssociatedValue PHP Метод

testThatIndexByDuplicateKeyWithForeachOnlyReturnsFirstAssociatedValue() публичный Метод

public testThatIndexByDuplicateKeyWithForeachOnlyReturnsFirstAssociatedValue ( Pinq\ITraversable $traversable, array $data )
$traversable Pinq\ITraversable
$data array
    public function testThatIndexByDuplicateKeyWithForeachOnlyReturnsFirstAssociatedValue(\Pinq\ITraversable $traversable, array $data)
    {
        $indexedElements = $traversable->indexBy(function () {
            return null;
        });
        $first = true;
        foreach ($indexedElements as $key => $element) {
            $this->assertSame($key, 0);
            $this->assertSame(reset($data), $element);
            $this->assertTrue($first);
            $first = false;
        }
    }