public function ClosureExpressionVisitorTest::testSortByFieldDescending in Plug 7
File
- lib/
doctrine/ collections/ tests/ Doctrine/ Tests/ Common/ Collections/ ClosureExpressionVisitorTest.php, line 180
Class
- ClosureExpressionVisitorTest
- @group DDC-1637
Namespace
Doctrine\Tests\Common\CollectionsCode
public function testSortByFieldDescending() {
$objects = array(
new TestObject("b"),
new TestObject("a"),
new TestObject("c"),
);
$sort = ClosureExpressionVisitor::sortByField("foo", -1);
usort($objects, $sort);
$this
->assertEquals("c", $objects[0]
->getFoo());
$this
->assertEquals("b", $objects[1]
->getFoo());
$this
->assertEquals("a", $objects[2]
->getFoo());
}