public function ArrayCollectionTest::testMatchingWithSortingPreservesyKeys in Plug 7
File
- lib/
doctrine/ collections/ tests/ Doctrine/ Tests/ Common/ Collections/ ArrayCollectionTest.php, line 273
Class
- ArrayCollectionTest
- Tests for { @covers \Doctrine\Common\Collections\ArrayCollection
Namespace
Doctrine\Tests\Common\CollectionsCode
public function testMatchingWithSortingPreservesyKeys() {
$object1 = new \stdClass();
$object2 = new \stdClass();
$object1->sortField = 2;
$object2->sortField = 1;
$collection = new ArrayCollection(array(
'object1' => $object1,
'object2' => $object2,
));
$this
->assertSame(array(
'object2' => $object2,
'object1' => $object1,
), $collection
->matching(new Criteria(null, array(
'sortField' => Criteria::ASC,
)))
->toArray());
}