Ejemplo n.º 1
0
 /**
  * Returns true if both DataTable are exactly the same.
  * Used in unit tests.
  * 
  * @param Piwik_DataTable $table1
  * @param Piwik_DataTable $table2
  * @return bool
  */
 public static function isEqual(Piwik_DataTable $table1, Piwik_DataTable $table2)
 {
     $rows1 = $table1->getRows();
     $rows2 = $table2->getRows();
     $table1->rebuildIndex();
     $table2->rebuildIndex();
     if ($table1->getRowsCount() != $table2->getRowsCount()) {
         return false;
     }
     foreach ($rows1 as $row1) {
         $row2 = $table2->getRowFromLabel($row1->getColumn('label'));
         if ($row2 === false || !Piwik_DataTable_Row::isEqual($row1, $row2)) {
             return false;
         }
     }
     return true;
 }