function testDontSortEmptyCollection() { $iterator = new lmbCollection(); $iterator->sort(array('x' => 'DESC')); $this->assertEqual($iterator->getArray(), array()); }
function testResetInternalIteratorOnSortToo() { $data = array(new lmbSet(array('x' => 'C')), new lmbSet(array('x' => 'A')), new lmbSet(array('x' => 'B'))); $iterator = new lmbCollection($data); $iterator->paginate($offset = 1, $limit = 2); $str = ''; foreach ($iterator as $record) { $str .= $record->get('x'); } $this->assertEqual($str, 'AB'); $iterator->sort(array('x' => 'DESC')); $str = ''; foreach ($iterator as $record) { $str .= $record->get('x'); } $this->assertEqual($str, 'BA'); }