Skip to content

Commit

Permalink
Adds Unit Test For Multi Column Sort
Browse files Browse the repository at this point in the history
  • Loading branch information
baileylo committed Aug 4, 2015
1 parent 4b1e0f4 commit 8314d60
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/Doctrine/Tests/Common/Collections/ArrayCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,4 +293,26 @@ public function testMatchingWithSortingPreservesyKeys()
->toArray()
);
}

public function testMultiColumnSortAppliesAllSorts()
{
$collection = new ArrayCollection(array(
array('foo' => 1, 'bar' => 2),
array('foo' => 2, 'bar' => 4),
array('foo' => 2, 'bar' => 3)
));

$expected = array(
1 => array('foo' => 2, 'bar' => 4),
2 => array('foo' => 2, 'bar' => 3),
0 => array('foo' => 1, 'bar' => 2)
);

$this->assertSame(
$expected,
$collection
->matching(new Criteria(null, array('foo' => Criteria::DESC, 'bar' => Criteria::DESC)))
->toArray()
);
}
}

0 comments on commit 8314d60

Please sign in to comment.