public function test_whenRowsInRandomOrderButSortSpecified_shouldComputeSummaryRowAfterSort() { $table = new Piwik_DataTable(); $table->addRow($this->getRow3()); $table->addRow($this->getRow2()); $table->addRow($this->getRow4()); $table->addRow($this->getRow1()); $table->addRow($this->getRow0()); $filter = new Piwik_DataTable_Filter_AddSummaryRow($table, 2, Piwik_DataTable::LABEL_SUMMARY_ROW, $columnToSortBy = 'nb'); $this->assertEqual($table->getRowsCount(), 3); $expectedRow = new Piwik_DataTable_Row(array(Piwik_DataTable_Row::COLUMNS => array('label' => Piwik_DataTable::LABEL_SUMMARY_ROW, 'nb' => 111))); $this->assertTrue(Piwik_DataTable_Row::isEqual($table->getLastRow(), $expectedRow)); }