lithium\tests\cases\data\CollectionTest::testSort PHP Method

testSort() public method

Tests the sort method in lithium\data\Collection.
public testSort ( )
    public function testSort()
    {
        $collection = new MockCollection(array('data' => array(array('id' => 1, 'name' => 'Annie'), array('id' => 2, 'name' => 'Zilean'), array('id' => 3, 'name' => 'Trynamere'), array('id' => 4, 'name' => 'Katarina'), array('id' => 5, 'name' => 'Nunu'))));
        $collection->sort('name');
        $idsSorted = $collection->map(function ($v) {
            return $v['id'];
        })->to('array');
        $this->assertEqual($idsSorted, array(1, 4, 5, 3, 2));
    }