public function testDescSorting() { $rows = array(); $rows[] = new Row(array('name' => 'a', 'age' => 35), array()); $rows[] = new Row(array('name' => 'b', 'age' => 28), array()); $rowSorter = new RowSorter($rows); $sortedRows = $rowSorter->sortRowsByCell('name', 'DESC'); $this->assertNotEquals($rows[0], $sortedRows[0]); }
private function buildTableRows($table, $rows) { $httpService = new HttpService(); if ($this->sortingEnabled && $httpService->sortingGetParamsAreSet()) { $rowSorter = new RowSorter($rows); $rows = $rowSorter->sortRowsByCell($httpService->getSortByValue(), $httpService->getSortDirection()); } if ($this->paginator) { $this->startPaginator($httpService, $rows); } /** @var Row $row */ foreach ($rows as $row) { $row->addActions($this->rowActions); $tr = $row->render(); $table->add($tr); } }