Pinq\Tests\Integration\Traversable\OrderByTest::testThatOrderByMaintainsNonScalarKeys PHP Метод

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

public testThatOrderByMaintainsNonScalarKeys ( Pinq\ITraversable $dates, array $data )
$dates Pinq\ITraversable
$data array
    public function testThatOrderByMaintainsNonScalarKeys(\Pinq\ITraversable $dates, array $data)
    {
        $years = $dates->indexBy(function (\DateTime $date) {
            return $date;
        })->select(function (\DateTime $date) {
            return (int) $date->format('Y');
        })->orderByDescending(function ($year, \DateTime $date) {
            return $year;
        })->select(function ($year, \DateTime $date) {
            return $date->format('Y');
        })->implode(':');
        $this->assertSame('2005:2004:2003:2002:2001:2000', $years);
    }