예제 #1
0
파일: Day.test.php 프로젝트: klando/pgpiwik
 function test_generateDataTable_1row4level()
 {
     $table = new Piwik_DataTable();
     $rowpagecat3 = new Piwik_DataTable_Row(array(Piwik_DataTable_Row::COLUMNS => array('label' => '123123', 'visits' => 3, 'actions' => 5)));
     $rowcat3 = new Piwik_DataTable_Row(array(Piwik_DataTable_Row::COLUMNS => array('label' => '789.654', 'visits' => 3, 'actions' => 5)));
     $rowcat2 = new Piwik_DataTable_Row(array(Piwik_DataTable_Row::COLUMNS => array('label' => 'cat2', 'visits' => 3, 'actions' => 5)));
     $rowcat1 = new Piwik_DataTable_Row(array(Piwik_DataTable_Row::COLUMNS => array('label' => '&*()', 'visits' => 3, 'actions' => 5)));
     $subtablerowpagecat3 = new Piwik_DataTable();
     $subtablerowpagecat3->addRow($rowpagecat3);
     $rowcat3->addSubtable($subtablerowpagecat3);
     $subtablecat2 = new Piwik_DataTable();
     $subtablecat2->addRow($rowcat3);
     $rowcat2->addSubtable($subtablecat2);
     $subtablecat1 = new Piwik_DataTable();
     $subtablecat1->addRow($rowcat2);
     $rowcat1->addSubtable($subtablecat1);
     //-- add
     $table->addRow($rowcat1);
     // WHAT WE TEST
     $input = array('&*()' => array('cat2' => array('789.654' => array('123123' => $rowpagecat3))));
     $tableGenerated = Piwik_ArchiveProcessing_Day::generateDataTable($input);
     $r1 = new Piwik_DataTable_Renderer_Console();
     $r1->setTable($table);
     $r2 = new Piwik_DataTable_Renderer_Console();
     $r2->setTable($tableGenerated);
     $this->assertTrue(Piwik_DataTable::isEqual($table, $tableGenerated));
 }