当前位置: 首页>>代码示例>>PHP>>正文


PHP Piwik_DataTable::isEqual方法代码示例

本文整理汇总了PHP中Piwik_DataTable::isEqual方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_DataTable::isEqual方法的具体用法?PHP Piwik_DataTable::isEqual怎么用?PHP Piwik_DataTable::isEqual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik_DataTable的用法示例。


在下文中一共展示了Piwik_DataTable::isEqual方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_filter_Lowpop1

 /**
  * Test to exclude low population filter
  */
 function test_filter_Lowpop1()
 {
     $idcol = Piwik_DataTable_Row::COLUMNS;
     $table = new Piwik_DataTable();
     $rows = array(array($idcol => array('label' => 'google', 'nb_visits' => 897)), array($idcol => array('label' => 'ask', 'nb_visits' => -152)), array($idcol => array('label' => 'piwik', 'nb_visits' => 1.5)), array($idcol => array('label' => 'piwik2', 'nb_visits' => 1.4)), array($idcol => array('label' => 'yahoo', 'nb_visits' => 154)), array($idcol => array('label' => 'amazon', 'nb_visits' => 30)), array($idcol => array('label' => '238949', 'nb_visits' => 0)), array($idcol => array('label' => 'Q*(%&*', 'nb_visits' => 1)), array($idcol => array('label' => 'Q*(%&*2', 'nb_visits' => -1.5)));
     $table->addRowsFromArray($rows);
     $expectedtable = new Piwik_DataTable();
     $rows = array(array($idcol => array('label' => 'google', 'nb_visits' => 897)), array($idcol => array('label' => 'piwik', 'nb_visits' => 1.5)), array($idcol => array('label' => 'piwik2', 'nb_visits' => 1.4)), array($idcol => array('label' => 'yahoo', 'nb_visits' => 154)), array($idcol => array('label' => 'amazon', 'nb_visits' => 30)));
     $expectedtable->addRowsFromArray($rows);
     $filter = new Piwik_DataTable_Filter_ExcludeLowPopulation($table, 'nb_visits', 1.4);
     $this->assertTrue(Piwik_DataTable::isEqual($table, $expectedtable));
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:15,代码来源:ExcludeLowPopulation.test.php

示例2: test_filter_SortNumeric

 /**
  * Test to sort by visit
  */
 function test_filter_SortNumeric()
 {
     $idcol = Piwik_DataTable_Row::COLUMNS;
     $table = new Piwik_DataTable();
     $rows = array(array($idcol => array('label' => 'google', 'nb_visits' => 897)), array($idcol => array('label' => 'ask', 'nb_visits' => -152)), array($idcol => array('label' => 'piwik', 'nb_visits' => 1.5)), array($idcol => array('label' => 'yahoo', 'nb_visits' => 154)), array($idcol => array('label' => 'amazon', 'nb_visits' => 30)), array($idcol => array('label' => '238949', 'nb_visits' => 0)), array($idcol => array('label' => 'Q*(%&*', 'nb_visits' => 1)));
     $table->addRowsFromArray($rows);
     $expectedtable = new Piwik_DataTable();
     $rows = array(array($idcol => array('label' => 'ask', 'nb_visits' => -152)), array($idcol => array('label' => '238949', 'nb_visits' => 0)), array($idcol => array('label' => 'Q*(%&*', 'nb_visits' => 1)), array($idcol => array('label' => 'piwik', 'nb_visits' => 1.5)), array($idcol => array('label' => 'amazon', 'nb_visits' => 30)), array($idcol => array('label' => 'yahoo', 'nb_visits' => 154)), array($idcol => array('label' => 'google', 'nb_visits' => 897)));
     $expectedtable->addRowsFromArray($rows);
     $expectedtableReverse = new Piwik_DataTable();
     $expectedtableReverse->addRowsFromArray(array_reverse($rows));
     $filter = new Piwik_DataTable_Filter_Sort($table, 'nb_visits', 'asc');
     $this->assertTrue(Piwik_DataTable::isEqual($table, $expectedtable));
     $filter = new Piwik_DataTable_Filter_Sort($table, 'nb_visits', 'desc');
     $this->assertTrue(Piwik_DataTable::isEqual($table, $expectedtableReverse));
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:19,代码来源:Sort.test.php

示例3: test_addOneTableWithSummaryRow

 public function test_addOneTableWithSummaryRow()
 {
     // row0, row1, row2, rowSummary1
     $table1 = $this->getDataTableCount5();
     $filter = new Piwik_DataTable_Filter_AddSummaryRow($table1, 3);
     // row0, row1, row2, row3, row4
     $table2 = $this->getDataTableCount5();
     // we expect row0+row0, row1+row1, row2+row2, row3, row4, rowSummary1
     $expectedTable = new Piwik_DataTable();
     $expectedTable->addRow(new Piwik_DataTable_Row(array(Piwik_DataTable_Row::COLUMNS => array('label' => 'amazon', 'nb' => 20000))));
     $expectedTable->addRow(new Piwik_DataTable_Row(array(Piwik_DataTable_Row::COLUMNS => array('label' => 'yahoo', 'nb' => 2000))));
     $expectedTable->addRow(new Piwik_DataTable_Row(array(Piwik_DataTable_Row::COLUMNS => array('label' => 'piwik', 'nb' => 200))));
     $expectedTable->addRow($this->getRow3());
     $expectedTable->addRow($this->getRow4());
     $expectedTable->addRow(new Piwik_DataTable_Row(array(Piwik_DataTable_Row::COLUMNS => array('label' => Piwik_DataTable::LABEL_SUMMARY_ROW, 'nb' => 11))));
     $table1->addDataTable($table2);
     $this->assertTrue(Piwik_DataTable::isEqual($expectedTable, $table1));
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:18,代码来源:AddSummaryRow.test.php

示例4: testAddDataTable2times

 /**
  * test add 2 different tables to the same table
  * 
  * @group Core
  * @group DataTable
  */
 public function testAddDataTable2times()
 {
     $idcol = Piwik_DataTable_Row::COLUMNS;
     $rows = array(array($idcol => array('label' => 'google', 'visits' => 1)), array($idcol => array('label' => 'ask', 'visits' => 0)), array($idcol => array('label' => '123', 'visits' => 2)), Piwik_DataTable::ID_SUMMARY_ROW => array($idcol => array('label' => Piwik_DataTable::LABEL_SUMMARY_ROW, 'visits' => 1)));
     $table = new Piwik_DataTable();
     $table->addRowsFromArray($rows);
     $rows2 = array(array($idcol => array('label' => 'google2', 'visits' => -1)), array($idcol => array('label' => 'ask', 'visits' => 100)), array($idcol => array('label' => '123456', 'visits' => 1.5)));
     $table2 = new Piwik_DataTable();
     $table2->addRowsFromArray($rows2);
     $rows3 = array(array($idcol => array('label' => 'google2', 'visits' => -1)), array($idcol => array('label' => 'ask', 'visits' => -10)), array($idcol => array('label' => '123ab', 'visits' => 1.5)), Piwik_DataTable::ID_SUMMARY_ROW => array($idcol => array('label' => Piwik_DataTable::LABEL_SUMMARY_ROW, 'visits' => 3)));
     $table3 = new Piwik_DataTable();
     $table3->addRowsFromArray($rows3);
     // add the 2 tables
     $table->addDataTable($table2);
     $table->addDataTable($table3);
     $rowsExpected = array(array($idcol => array('label' => 'google', 'visits' => 1)), array($idcol => array('label' => 'ask', 'visits' => 90)), array($idcol => array('label' => '123', 'visits' => 2)), array($idcol => array('label' => 'google2', 'visits' => -2)), array($idcol => array('label' => '123456', 'visits' => 1.5)), array($idcol => array('label' => '123ab', 'visits' => 1.5)), Piwik_DataTable::ID_SUMMARY_ROW => array($idcol => array('label' => Piwik_DataTable::LABEL_SUMMARY_ROW, 'visits' => 4)));
     $tableExpected = new Piwik_DataTable();
     $tableExpected->addRowsFromArray($rowsExpected);
     $this->assertTrue(Piwik_DataTable::isEqual($table, $tableExpected));
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:26,代码来源:DataTableTest.php

示例5: isEqual

 /**
  * Helper function to test if two rows are equal.
  * 
  * Two rows are equal 
  * - if they have exactly the same columns / metadata
  * - if they have a subDataTable associated, then we check that both of them are the same.
  * 
  * @param Piwik_DataTable_Row row1 to compare
  * @param Piwik_DataTable_Row row2 to compare
  * 
  * @return bool
  */
 public static function isEqual(Piwik_DataTable_Row $row1, Piwik_DataTable_Row $row2)
 {
     //same columns
     $cols1 = $row1->getColumns();
     $cols2 = $row2->getColumns();
     $diff1 = array_udiff($cols1, $cols2, array(__CLASS__, 'compareElements'));
     $diff2 = array_udiff($cols2, $cols1, array(__CLASS__, 'compareElements'));
     if ($diff1 != $diff2) {
         return false;
     }
     $dets1 = $row1->getMetadata();
     $dets2 = $row2->getMetadata();
     ksort($dets1);
     ksort($dets2);
     if ($dets1 != $dets2) {
         return false;
     }
     // either both are null
     // or both have a value
     if (!(is_null($row1->getIdSubDataTable()) && is_null($row2->getIdSubDataTable()))) {
         $subtable1 = Piwik_DataTable_Manager::getInstance()->getTable($row1->getIdSubDataTable());
         $subtable2 = Piwik_DataTable_Manager::getInstance()->getTable($row2->getIdSubDataTable());
         if (!Piwik_DataTable::isEqual($subtable1, $subtable2)) {
             return false;
         }
     }
     return true;
 }
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:40,代码来源:Row.php

示例6: isEqual

 /**
  * Helper function to test if two rows are equal.
  * 
  * Two rows are equal 
  * - if they have exactly the same columns / details
  * - if they have a subDataTable associated, then we check that both of them are the same.
  * 
  * @param Piwik_DataTable_Row row1 to compare
  * @param Piwik_DataTable_Row row2 to compare
  * 
  * @return bool
  */
 public static function isEqual(Piwik_DataTable_Row $row1, Piwik_DataTable_Row $row2)
 {
     //same columns
     $cols1 = $row1->getColumns();
     $cols2 = $row2->getColumns();
     uksort($cols1, 'strnatcasecmp');
     uksort($cols2, 'strnatcasecmp');
     if ($cols1 != $cols2) {
         return false;
     }
     $dets1 = $row1->getDetails();
     $dets2 = $row2->getDetails();
     ksort($dets1);
     ksort($dets2);
     // same details
     if ($dets1 != $dets2) {
         return false;
     }
     // either both are null
     // or both have a value
     if (!(is_null($row1->getIdSubDataTable()) && is_null($row2->getIdSubDataTable()))) {
         $subtable1 = Piwik_DataTable_Manager::getInstance()->getTable($row1->getIdSubDataTable());
         $subtable2 = Piwik_DataTable_Manager::getInstance()->getTable($row2->getIdSubDataTable());
         if (!Piwik_DataTable::isEqual($subtable1, $subtable2)) {
             return false;
         }
     }
     return true;
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:41,代码来源:Row.php

示例7: test_generateDataTable_1row4level

 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));
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:27,代码来源:Day.test.php


注:本文中的Piwik_DataTable::isEqual方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。