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


PHP DataTable::isEqual方法代码示例

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


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

示例1: testFilterLowpop1

 /**
  * Test to exclude low population filter
  *
  * @group Core
  */
 public function testFilterLowpop1()
 {
     $idcol = Row::COLUMNS;
     $table = new 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 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 ExcludeLowPopulation($table, 'nb_visits', 1.4);
     $filter->filter($table);
     $this->assertTrue(DataTable::isEqual($table, $expectedtable));
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:18,代码来源:ExcludeLowPopulationTest.php

示例2: testAddOneTableWithSummaryRow

 public function testAddOneTableWithSummaryRow()
 {
     // row0, row1, row2, rowSummary1
     $table1 = $this->getDataTableCount5();
     $filter = new Truncate($table1, 3);
     $filter->filter($table1);
     // row0, row1, row2, row3, row4
     $table2 = $this->getDataTableCount5();
     // we expect row0+row0, row1+row1, row2+row2, row3, row4, rowSummary1
     $expectedTable = new DataTable();
     $expectedTable->addRow(new Row(array(Row::COLUMNS => array('label' => 'amazon', 'nb' => 20000))));
     $expectedTable->addRow(new Row(array(Row::COLUMNS => array('label' => 'yahoo', 'nb' => 2000))));
     $expectedTable->addRow(new Row(array(Row::COLUMNS => array('label' => 'piwik', 'nb' => 200))));
     $expectedTable->addRow($this->getRow3());
     $expectedTable->addRow($this->getRow4());
     $expectedTable->addRow(new Row(array(Row::COLUMNS => array('label' => DataTable::LABEL_SUMMARY_ROW, 'nb' => 11))));
     $table1->addDataTable($table2);
     $this->assertTrue(DataTable::isEqual($expectedTable, $table1));
 }
开发者ID:mgou-net,项目名称:piwik,代码行数:19,代码来源:TruncateTest.php

示例3: testAddDataTable2times

 /**
  * test add 2 different tables to the same table
  */
 public function testAddDataTable2times()
 {
     $idcol = 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)), DataTable::ID_SUMMARY_ROW => array($idcol => array('label' => DataTable::LABEL_SUMMARY_ROW, 'visits' => 1)));
     $table = new 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 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)), DataTable::ID_SUMMARY_ROW => array($idcol => array('label' => DataTable::LABEL_SUMMARY_ROW, 'visits' => 3)));
     $table3 = new 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)), DataTable::ID_SUMMARY_ROW => array($idcol => array('label' => DataTable::LABEL_SUMMARY_ROW, 'visits' => 4)));
     $tableExpected = new DataTable();
     $tableExpected->addRowsFromArray($rowsExpected);
     $this->assertTrue(DataTable::isEqual($table, $tableExpected));
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:23,代码来源:DataTableTest.php

示例4: isEqual

 /**
  * Helper function that tests if two rows are equal.
  *
  * Two rows are equal if:
  *
  * - they have exactly the same columns / metadata
  * - they have a subDataTable associated, then we check that both of them are the same.
  *
  * Column order is not important.
  *
  * @param \Piwik\DataTable\Row $row1 first to compare
  * @param \Piwik\DataTable\Row $row2 second to compare
  * @return bool
  */
 public static function isEqual(Row $row1, 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 = $row1->getSubtable();
         $subtable2 = $row2->getSubtable();
         if (!DataTable::isEqual($subtable1, $subtable2)) {
             return false;
         }
     }
     return true;
 }
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:42,代码来源:Row.php

示例5: testFilterSortNumeric

 /**
  * Test to sort by visit
  *
  * @group Core
  */
 public function testFilterSortNumeric()
 {
     $idcol = Row::COLUMNS;
     $table = new 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 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 DataTable();
     $expectedtableReverse->addRowsFromArray(array_reverse($rows));
     $filter = new Sort($table, 'nb_visits', 'asc');
     $filter->filter($table);
     $this->assertTrue(DataTable::isEqual($table, $expectedtable));
     $filter = new Sort($table, 'nb_visits', 'desc');
     $filter->filter($table);
     $this->assertTrue(DataTable::isEqual($table, $expectedtableReverse));
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:23,代码来源:SortTest.php

示例6: test_sortingArrayValues_doesNotError

 public function test_sortingArrayValues_doesNotError()
 {
     $table = new DataTable();
     $table->addRowsFromArray(array(array(Row::COLUMNS => array('label' => 'ask', 'count_array' => array(100, 1, 2))), array(Row::COLUMNS => array('label' => 'nintendo', 'count_array' => array(0, 'hello'))), array(Row::COLUMNS => array('label' => 'yahoo', 'count_array' => array(10, 'test')))));
     $tableOriginal = clone $table;
     $filter = new Sort($table, 'count_array', 'desc');
     $filter->filter($table);
     $this->assertTrue(DataTable::isEqual($tableOriginal, $table));
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:9,代码来源:SortTest.php

示例7: test_sumSubTable_whenSubTableAlreadyExists_overwriteExistingSubtable

 public function test_sumSubTable_whenSubTableAlreadyExists_overwriteExistingSubtable()
 {
     $testRow = $this->getTestRowWithSubDataTableNotLoaded();
     $this->assertFalse($testRow->isSubtableLoaded());
     $subTable = $this->getTestSubDataTable();
     $testRow->setSubtable($subTable);
     $testRow->switchFlagSubtableIsLoaded();
     $this->assertFalse($testRow->isSubtableLoaded());
     $testRow->sumSubtable($subTable);
     $this->assertTrue(DataTable::isEqual($testRow->getSubtable(), $subTable));
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:11,代码来源:RowTest.php


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