You are here

public function ClosureExpressionVisitorTest::testSortByFieldAscending in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.php \Doctrine\Tests\Common\Collections\ClosureExpressionVisitorTest::testSortByFieldAscending()

File

vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.php, line 168

Class

ClosureExpressionVisitorTest
@group DDC-1637

Namespace

Doctrine\Tests\Common\Collections

Code

public function testSortByFieldAscending() {
  $objects = array(
    new TestObject("b"),
    new TestObject("a"),
    new TestObject("c"),
  );
  $sort = ClosureExpressionVisitor::sortByField("foo");
  usort($objects, $sort);
  $this
    ->assertEquals("a", $objects[0]
    ->getFoo());
  $this
    ->assertEquals("b", $objects[1]
    ->getFoo());
  $this
    ->assertEquals("c", $objects[2]
    ->getFoo());
}