diff options
Diffstat (limited to 'tests/PHPUnit/Core/DataTable/Filter')
8 files changed, 193 insertions, 163 deletions
diff --git a/tests/PHPUnit/Core/DataTable/Filter/AddSummaryRowTest.php b/tests/PHPUnit/Core/DataTable/Filter/AddSummaryRowTest.php index 5071d2b815..05136a1c27 100644 --- a/tests/PHPUnit/Core/DataTable/Filter/AddSummaryRowTest.php +++ b/tests/PHPUnit/Core/DataTable/Filter/AddSummaryRowTest.php @@ -5,6 +5,10 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ +use Piwik\DataTable; +use Piwik\DataTable\Filter\AddSummaryRow; +use Piwik\DataTable\Row; + class DataTable_Filter_AddSummaryRowTest extends PHPUnit_Framework_TestCase { /** @@ -17,10 +21,10 @@ class DataTable_Filter_AddSummaryRowTest extends PHPUnit_Framework_TestCase public function testOffsetIsCountSummaryRowShouldBeTheRow() { $table = $this->getDataTableCount5(); - $filter = new Piwik_DataTable_Filter_AddSummaryRow($table, 5); + $filter = new AddSummaryRow($table, 5); $filter->filter($table); $this->assertEquals(5, $table->getRowsCount()); - $this->assertTrue(Piwik_DataTable_Row::isEqual($table->getLastRow(), $this->getRow4())); + $this->assertTrue(Row::isEqual($table->getLastRow(), $this->getRow4())); } /** @@ -33,11 +37,11 @@ class DataTable_Filter_AddSummaryRowTest extends PHPUnit_Framework_TestCase public function testOffsetIsLessThanCountSummaryRowShouldBeTheSum() { $table = $this->getDataTableCount5(); - $filter = new Piwik_DataTable_Filter_AddSummaryRow($table, 2); + $filter = new AddSummaryRow($table, 2); $filter->filter($table); $this->assertEquals(3, $table->getRowsCount()); - $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)); + $expectedRow = new Row(array(Row::COLUMNS => array('label' => DataTable::LABEL_SUMMARY_ROW, 'nb' => 111))); + $this->assertTrue(Row::isEqual($table->getLastRow(), $expectedRow)); // check that column 'label' is forced to be first in summary row $this->assertEquals(array_keys($table->getLastRow()->getColumns()), array_keys($expectedRow->getColumns())); } @@ -52,10 +56,10 @@ class DataTable_Filter_AddSummaryRowTest extends PHPUnit_Framework_TestCase public function testOffsetIsMoreThanCountShouldNotAddSummaryRow() { $table = $this->getDataTableCount5(); - $filter = new Piwik_DataTable_Filter_AddSummaryRow($table, 6); + $filter = new AddSummaryRow($table, 6); $filter->filter($table); $this->assertEquals(5, $table->getRowsCount()); - $this->assertTrue(Piwik_DataTable_Row::isEqual($table->getLastRow(), $this->getRow4())); + $this->assertTrue(Row::isEqual($table->getLastRow(), $this->getRow4())); } /** @@ -68,13 +72,13 @@ class DataTable_Filter_AddSummaryRowTest extends PHPUnit_Framework_TestCase public function testWhenThereIsAlreadyASummaryRowShouldReplaceTheSummaryRow() { $table = $this->getDataTableCount5(); - $filter1 = new Piwik_DataTable_Filter_AddSummaryRow($table, 3); + $filter1 = new AddSummaryRow($table, 3); $filter1->filter($table); - $filter2 = new Piwik_DataTable_Filter_AddSummaryRow($table, 2); + $filter2 = new AddSummaryRow($table, 2); $filter2->filter($table); $this->assertEquals(3, $table->getRowsCount()); - $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)); + $expectedRow = new Row(array(Row::COLUMNS => array('label' => DataTable::LABEL_SUMMARY_ROW, 'nb' => 111))); + $this->assertTrue(Row::isEqual($table->getLastRow(), $expectedRow)); } /** @@ -88,23 +92,23 @@ class DataTable_Filter_AddSummaryRowTest extends PHPUnit_Framework_TestCase { // row0, row1, row2, rowSummary1 $table1 = $this->getDataTableCount5(); - $filter = new Piwik_DataTable_Filter_AddSummaryRow($table1, 3); + $filter = new AddSummaryRow($table1, 3); $filter->filter($table1); // row0, row1, rowSummary2 $table2 = $this->getDataTableCount5(); - $filter = new Piwik_DataTable_Filter_AddSummaryRow($table2, 2); + $filter = new AddSummaryRow($table2, 2); $filter->filter($table2); // we expect row0+row0, row1+row1, row2, rowSummary1+rowSummary2 - $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' => 100)))); - $expectedTable->addRow(new Piwik_DataTable_Row(array(Piwik_DataTable_Row::COLUMNS => array('label' => Piwik_DataTable::LABEL_SUMMARY_ROW, 'nb' => 122)))); + $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' => 100)))); + $expectedTable->addRow(new Row(array(Row::COLUMNS => array('label' => DataTable::LABEL_SUMMARY_ROW, 'nb' => 122)))); $table1->addDataTable($table2); - $this->assertTrue(Piwik_DataTable::isEqual($expectedTable, $table1)); + $this->assertTrue(DataTable::isEqual($expectedTable, $table1)); } /** @@ -118,23 +122,23 @@ class DataTable_Filter_AddSummaryRowTest extends PHPUnit_Framework_TestCase { // row0, row1, row2, rowSummary1 $table1 = $this->getDataTableCount5(); - $filter = new Piwik_DataTable_Filter_AddSummaryRow($table1, 3); + $filter = new AddSummaryRow($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 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 = 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 Piwik_DataTable_Row(array(Piwik_DataTable_Row::COLUMNS => array('label' => Piwik_DataTable::LABEL_SUMMARY_ROW, 'nb' => 11)))); + $expectedTable->addRow(new Row(array(Row::COLUMNS => array('label' => DataTable::LABEL_SUMMARY_ROW, 'nb' => 11)))); $table1->addDataTable($table2); - $this->assertTrue(Piwik_DataTable::isEqual($expectedTable, $table1)); + $this->assertTrue(DataTable::isEqual($expectedTable, $table1)); } @@ -147,28 +151,28 @@ class DataTable_Filter_AddSummaryRowTest extends PHPUnit_Framework_TestCase */ public function testWhenRowsInRandomOrderButSortSpecifiedShouldComputeSummaryRowAfterSort() { - $table = new Piwik_DataTable; + $table = new 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'); + $filter = new AddSummaryRow($table, 2, DataTable::LABEL_SUMMARY_ROW, $columnToSortBy = 'nb'); $filter->filter($table); $this->assertEquals(3, $table->getRowsCount()); - $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)); + $expectedRow = new Row(array(Row::COLUMNS => array('label' => DataTable::LABEL_SUMMARY_ROW, 'nb' => 111))); + $this->assertTrue(Row::isEqual($table->getLastRow(), $expectedRow)); } /** * Returns table used for the tests * - * @return Piwik_DataTable + * @return DataTable */ protected function getDataTableCount5() { - $table = new Piwik_DataTable; + $table = new DataTable; $table->addRow($this->getRow0()); $table->addRow($this->getRow1()); $table->addRow($this->getRow2()); @@ -179,26 +183,26 @@ class DataTable_Filter_AddSummaryRowTest extends PHPUnit_Framework_TestCase protected function getRow0() { - return new Piwik_DataTable_Row(array(Piwik_DataTable_Row::COLUMNS => array('nb' => 10000, 'label' => 'amazon'))); + return new Row(array(Row::COLUMNS => array('nb' => 10000, 'label' => 'amazon'))); } protected function getRow1() { - return new Piwik_DataTable_Row(array(Piwik_DataTable_Row::COLUMNS => array('label' => 'yahoo', 'nb' => 1000))); + return new Row(array(Row::COLUMNS => array('label' => 'yahoo', 'nb' => 1000))); } protected function getRow2() { - return new Piwik_DataTable_Row(array(Piwik_DataTable_Row::COLUMNS => array('label' => 'piwik', 'nb' => 100))); + return new Row(array(Row::COLUMNS => array('label' => 'piwik', 'nb' => 100))); } protected function getRow3() { - return new Piwik_DataTable_Row(array(Piwik_DataTable_Row::COLUMNS => array('label' => 'ask', 'nb' => 10))); + return new Row(array(Row::COLUMNS => array('label' => 'ask', 'nb' => 10))); } protected function getRow4() { - return new Piwik_DataTable_Row(array(Piwik_DataTable_Row::COLUMNS => array('nb' => 1, 'label' => 'google'))); + return new Row(array(Row::COLUMNS => array('nb' => 1, 'label' => 'google'))); } } diff --git a/tests/PHPUnit/Core/DataTable/Filter/ExcludeLowPopulationTest.php b/tests/PHPUnit/Core/DataTable/Filter/ExcludeLowPopulationTest.php index 5ebb772c72..084343329f 100644 --- a/tests/PHPUnit/Core/DataTable/Filter/ExcludeLowPopulationTest.php +++ b/tests/PHPUnit/Core/DataTable/Filter/ExcludeLowPopulationTest.php @@ -5,19 +5,23 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ +use Piwik\DataTable; +use Piwik\DataTable\Filter\ExcludeLowPopulation; +use Piwik\DataTable\Row; + class DataTable_Filter_ExcludeLowPopulationTest extends PHPUnit_Framework_TestCase { protected function getTestDataTable() { - $table = new Piwik_DataTable; + $table = new DataTable; $table->addRowsFromArray( array( - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'zero', 'count' => 0)), - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'one', 'count' => 1)), - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'onedotfive', 'count' => 1.5)), - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'ten', 'count' => 10)), - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'ninety', 'count' => 90)), - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'hundred', 'count' => 100)), + array(Row::COLUMNS => array('label' => 'zero', 'count' => 0)), + array(Row::COLUMNS => array('label' => 'one', 'count' => 1)), + array(Row::COLUMNS => array('label' => 'onedotfive', 'count' => 1.5)), + array(Row::COLUMNS => array('label' => 'ten', 'count' => 10)), + array(Row::COLUMNS => array('label' => 'ninety', 'count' => 90)), + array(Row::COLUMNS => array('label' => 'hundred', 'count' => 100)), ) ); return $table; @@ -33,7 +37,7 @@ class DataTable_Filter_ExcludeLowPopulationTest extends PHPUnit_Framework_TestCa public function testStandardTable() { $table = $this->getTestDataTable(); - $filter = new Piwik_DataTable_Filter_ExcludeLowPopulation($table, 'count', 1.1); + $filter = new ExcludeLowPopulation($table, 'count', 1.1); $filter->filter($table); $this->assertEquals(4, $table->getRowsCount()); $this->assertEquals(array(1.5, 10, 90, 100), $table->getColumn('count')); @@ -49,7 +53,7 @@ class DataTable_Filter_ExcludeLowPopulationTest extends PHPUnit_Framework_TestCa public function testFilterEqualOneDoesFilter() { $table = $this->getTestDataTable(); - $filter = new Piwik_DataTable_Filter_ExcludeLowPopulation($table, 'count', 1); + $filter = new ExcludeLowPopulation($table, 'count', 1); $filter->filter($table); $this->assertEquals(5, $table->getRowsCount()); } @@ -64,7 +68,7 @@ class DataTable_Filter_ExcludeLowPopulationTest extends PHPUnit_Framework_TestCa public function testFilterEqualZeroDoesFilter() { $table = $this->getTestDataTable(); - $filter = new Piwik_DataTable_Filter_ExcludeLowPopulation($table, 'count', 0); + $filter = new ExcludeLowPopulation($table, 'count', 0); $filter->filter($table); $this->assertEquals(3, $table->getRowsCount()); $this->assertEquals(array(10, 90, 100), $table->getColumn('count')); @@ -80,7 +84,7 @@ class DataTable_Filter_ExcludeLowPopulationTest extends PHPUnit_Framework_TestCa public function testFilterSpecifyExcludeLowPopulationThresholdDoesFilter() { $table = $this->getTestDataTable(); - $filter = new Piwik_DataTable_Filter_ExcludeLowPopulation($table, 'count', 0, 0.4); //40% + $filter = new ExcludeLowPopulation($table, 'count', 0, 0.4); //40% $filter->filter($table); $this->assertEquals(2, $table->getRowsCount()); $this->assertEquals(array(90, 100), $table->getColumn('count')); @@ -98,9 +102,9 @@ class DataTable_Filter_ExcludeLowPopulationTest extends PHPUnit_Framework_TestCa public function testFilterLowpop1() { - $idcol = Piwik_DataTable_Row::COLUMNS; + $idcol = Row::COLUMNS; - $table = new Piwik_DataTable(); + $table = new DataTable(); $rows = array( array($idcol => array('label' => 'google', 'nb_visits' => 897)), //0 array($idcol => array('label' => 'ask', 'nb_visits' => -152)), //1 @@ -114,7 +118,7 @@ class DataTable_Filter_ExcludeLowPopulationTest extends PHPUnit_Framework_TestCa ); $table->addRowsFromArray($rows); - $expectedtable = new Piwik_DataTable(); + $expectedtable = new DataTable(); $rows = array( array($idcol => array('label' => 'google', 'nb_visits' => 897)), //0 array($idcol => array('label' => 'piwik', 'nb_visits' => 1.5)), //2 @@ -124,9 +128,9 @@ class DataTable_Filter_ExcludeLowPopulationTest extends PHPUnit_Framework_TestCa ); $expectedtable->addRowsFromArray($rows); - $filter = new Piwik_DataTable_Filter_ExcludeLowPopulation($table, 'nb_visits', 1.4); + $filter = new ExcludeLowPopulation($table, 'nb_visits', 1.4); $filter->filter($table); - $this->assertTrue(Piwik_DataTable::isEqual($table, $expectedtable)); + $this->assertTrue(DataTable::isEqual($table, $expectedtable)); } } diff --git a/tests/PHPUnit/Core/DataTable/Filter/LimitTest.php b/tests/PHPUnit/Core/DataTable/Filter/LimitTest.php index 37a9e20d58..21d713c22e 100644 --- a/tests/PHPUnit/Core/DataTable/Filter/LimitTest.php +++ b/tests/PHPUnit/Core/DataTable/Filter/LimitTest.php @@ -5,17 +5,21 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ +use Piwik\DataTable; +use Piwik\DataTable\Filter\Limit; +use Piwik\DataTable\Row; + class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase { /** * Returns table used for the tests * - * @return Piwik_DataTable + * @return DataTable */ protected function getDataTableCount10() { - $table = new Piwik_DataTable; - $idcol = Piwik_DataTable_Row::COLUMNS; + $table = new DataTable; + $idcol = Row::COLUMNS; $rows = array( array($idcol => array('label' => 'google', 'idRow' => 0)), array($idcol => array('label' => 'ask', 'idRow' => 1)), @@ -26,7 +30,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase array($idcol => array('label' => 'test', 'idRow' => 6)), array($idcol => array('label' => 'amazing', 'idRow' => 7)), array($idcol => array('label' => 'great', 'idRow' => 8)), - Piwik_DataTable::ID_SUMMARY_ROW => array($idcol => array('label' => 'summary row', 'idRow' => 9)), + DataTable::ID_SUMMARY_ROW => array($idcol => array('label' => 'summary row', 'idRow' => 9)), ); $table->addRowsFromArray($rows); return $table; @@ -44,7 +48,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase $offset = 2; $limit = 3; $table = $this->getDataTableCount10(); - $filter = new Piwik_DataTable_Filter_Limit($table, $offset, $limit); + $filter = new Limit($table, $offset, $limit); $filter->filter($table); $this->assertEquals(3, $table->getRowsCount()); $this->assertEquals(2, $table->getFirstRow()->getColumn('idRow')); @@ -64,7 +68,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase $offset = 2; $limit = 7; $table = $this->getDataTableCount10(); - $filter = new Piwik_DataTable_Filter_Limit($table, $offset, $limit); + $filter = new Limit($table, $offset, $limit); $filter->filter($table); $this->assertEquals(7, $table->getRowsCount()); $this->assertEquals(2, $table->getFirstRow()->getColumn('idRow')); @@ -85,7 +89,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase $limit = 10; $table = $this->getDataTableCount10(); $this->assertEquals(10, $table->getRowsCountBeforeLimitFilter()); - $filter = new Piwik_DataTable_Filter_Limit($table, $offset, $limit); + $filter = new Limit($table, $offset, $limit); $filter->filter($table); $this->assertEquals(10, $table->getRowsCount()); $this->assertEquals(0, $table->getFirstRow()->getColumn('idRow')); @@ -106,7 +110,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase $limit = 20; $table = $this->getDataTableCount10(); $this->assertEquals(10, $table->getRowsCountBeforeLimitFilter()); - $filter = new Piwik_DataTable_Filter_Limit($table, $offset, $limit); + $filter = new Limit($table, $offset, $limit); $filter->filter($table); $this->assertEquals(5, $table->getRowsCount()); $this->assertEquals(5, $table->getFirstRow()->getColumn('idRow')); @@ -125,7 +129,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase { $offset = 1; $table = $this->getDataTableCount10(); - $filter = new Piwik_DataTable_Filter_Limit($table, $offset); + $filter = new Limit($table, $offset); $filter->filter($table); $this->assertEquals(9, $table->getRowsCount()); $this->assertEquals(1, $table->getFirstRow()->getColumn('idRow')); @@ -145,7 +149,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase $offset = 9; $limit = 1; $table = $this->getDataTableCount10(); - $filter = new Piwik_DataTable_Filter_Limit($table, $offset, $limit); + $filter = new Limit($table, $offset, $limit); $filter->filter($table); $this->assertEquals(1, $table->getRowsCount()); $this->assertEquals(9, $table->getFirstRow()->getColumn('idRow')); @@ -165,7 +169,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase $offset = 9; $limit = 100; $table = $this->getDataTableCount10(); - $filter = new Piwik_DataTable_Filter_Limit($table, $offset, $limit); + $filter = new Limit($table, $offset, $limit); $filter->filter($table); $this->assertEquals(1, $table->getRowsCount()); $this->assertEquals(9, $table->getFirstRow()->getColumn('idRow')); @@ -185,7 +189,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase $offset = 8; $limit = 3; $table = $this->getDataTableCount10(); - $filter = new Piwik_DataTable_Filter_Limit($table, $offset, $limit); + $filter = new Limit($table, $offset, $limit); $filter->filter($table); $this->assertEquals(2, $table->getRowsCount()); $this->assertEquals(8, $table->getFirstRow()->getColumn('idRow')); @@ -205,7 +209,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase $offset = 10; $limit = 10; $table = $this->getDataTableCount10(); - $filter = new Piwik_DataTable_Filter_Limit($table, $offset, $limit); + $filter = new Limit($table, $offset, $limit); $filter->filter($table); $this->assertEquals(0, $table->getRowsCount()); $this->assertEquals(10, $table->getRowsCountBeforeLimitFilter()); @@ -223,7 +227,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase $offset = 0; $limit = 0; $table = $this->getDataTableCount10(); - $filter = new Piwik_DataTable_Filter_Limit($table, $offset, $limit); + $filter = new Limit($table, $offset, $limit); $filter->filter($table); $this->assertEquals(0, $table->getRowsCount()); $this->assertEquals(10, $table->getRowsCountBeforeLimitFilter()); @@ -239,9 +243,9 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase */ public function testFilterOffsetLimit() { - $table = new Piwik_DataTable; + $table = new DataTable; - $idcol = Piwik_DataTable_Row::COLUMNS; + $idcol = Row::COLUMNS; $rows = array( array($idcol => array('label' => 'google')), //0 @@ -258,7 +262,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase $expectedtable = clone $table; $expectedtable->deleteRows(array(0, 1, 6)); - $filter = new Piwik_DataTable_Filter_Limit($table, 2, 4); + $filter = new Limit($table, 2, 4); $filter->filter($table); $colAfter = $colExpected = array(); @@ -278,9 +282,9 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase */ public function testFilterOffsetLimitOffbound() { - $table = new Piwik_DataTable; + $table = new DataTable; - $idcol = Piwik_DataTable_Row::COLUMNS; + $idcol = Row::COLUMNS; $rows = array( array($idcol => array('label' => 'google')), //0 @@ -297,7 +301,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase $expectedtable = clone $table; $expectedtable->deleteRows(array(0, 1, 3, 4, 5, 6)); - $filter = new Piwik_DataTable_Filter_Limit($table, 2, 1); + $filter = new Limit($table, 2, 1); $filter->filter($table); $colAfter = $colExpected = array(); @@ -317,9 +321,9 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase */ public function testFilterOffsetLimit2() { - $table = new Piwik_DataTable; + $table = new DataTable; - $idcol = Piwik_DataTable_Row::COLUMNS; + $idcol = Row::COLUMNS; $rows = array( array($idcol => array('label' => 'google')), //0 @@ -335,7 +339,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase $expectedtable = clone $table; - $filter = new Piwik_DataTable_Filter_Limit($table, 0, 15); + $filter = new Limit($table, 0, 15); $filter->filter($table); $colAfter = $colExpected = array(); @@ -355,9 +359,9 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase */ public function testFilterOffsetLimit3() { - $table = new Piwik_DataTable; + $table = new DataTable; - $idcol = Piwik_DataTable_Row::COLUMNS; + $idcol = Row::COLUMNS; $rows = array( array($idcol => array('label' => 'google')), //0 @@ -371,9 +375,9 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase $table->addRowsFromArray($rows); - $expectedtable = new Piwik_DataTable; + $expectedtable = new DataTable; - $filter = new Piwik_DataTable_Filter_Limit($table, 8, 15); + $filter = new Limit($table, 8, 15); $filter->filter($table); $colAfter = $colExpected = array(); diff --git a/tests/PHPUnit/Core/DataTable/Filter/PatternRecursiveTest.php b/tests/PHPUnit/Core/DataTable/Filter/PatternRecursiveTest.php index 5efc2dac7a..f9e7e0da27 100644 --- a/tests/PHPUnit/Core/DataTable/Filter/PatternRecursiveTest.php +++ b/tests/PHPUnit/Core/DataTable/Filter/PatternRecursiveTest.php @@ -5,32 +5,35 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ +use Piwik\DataTable; +use Piwik\DataTable\Row; + class DataTable_Filter_PatternRecursiveTest extends PHPUnit_Framework_TestCase { /** * Returns a data table for testing - * @return Piwik_DataTable + * @return DataTable */ protected function getTable() { - $subtableAskPath1 = new Piwik_DataTable(); + $subtableAskPath1 = new DataTable(); $subtableAskPath1->addRowsFromArray(array( - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'path1-index-page.html')), - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'another-page')), + array(Row::COLUMNS => array('label' => 'path1-index-page.html')), + array(Row::COLUMNS => array('label' => 'another-page')), )); - $subtableAsk = new Piwik_DataTable(); + $subtableAsk = new DataTable(); $subtableAsk->addRowsFromArray(array( - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'path1'), - Piwik_DataTable_Row::DATATABLE_ASSOCIATED => $subtableAskPath1), - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'index.html')), + array(Row::COLUMNS => array('label' => 'path1'), + Row::DATATABLE_ASSOCIATED => $subtableAskPath1), + array(Row::COLUMNS => array('label' => 'index.html')), )); - $table = new Piwik_DataTable; + $table = new DataTable; $rows = array( - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'http://www.ask.com'), - Piwik_DataTable_Row::DATATABLE_ASSOCIATED => $subtableAsk), - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'yahoo')), + array(Row::COLUMNS => array('label' => 'http://www.ask.com'), + Row::DATATABLE_ASSOCIATED => $subtableAsk), + array(Row::COLUMNS => array('label' => 'yahoo')), ); $table->addRowsFromArray($rows); return $table; diff --git a/tests/PHPUnit/Core/DataTable/Filter/PatternTest.php b/tests/PHPUnit/Core/DataTable/Filter/PatternTest.php index d90de04a44..b6f1893d8b 100644 --- a/tests/PHPUnit/Core/DataTable/Filter/PatternTest.php +++ b/tests/PHPUnit/Core/DataTable/Filter/PatternTest.php @@ -5,6 +5,9 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ +use Piwik\DataTable; +use Piwik\DataTable\Row; + class DataTable_Filter_PatternTest extends PHPUnit_Framework_TestCase { /** @@ -33,16 +36,16 @@ class DataTable_Filter_PatternTest extends PHPUnit_Framework_TestCase */ public function testFilterPattern($test) { - $table = new Piwik_DataTable; + $table = new DataTable; - $idcol = Piwik_DataTable_Row::COLUMNS; + $idcol = Row::COLUMNS; $rows = array( array($idcol => array('label' => 'google')), array($idcol => array('label' => 'ask')), array($idcol => array('label' => 'piwik')), array($idcol => array('label' => 'yahoo')), - array(Piwik_DataTable_Row::METADATA => array('label' => 'amazon')), + array(Row::METADATA => array('label' => 'amazon')), array($idcol => array('label' => '2389752/47578949')), array($idcol => array('label' => 'Q*(%&*("$&%*(&"$*")"))')) ); diff --git a/tests/PHPUnit/Core/DataTable/Filter/RangeCheckTest.php b/tests/PHPUnit/Core/DataTable/Filter/RangeCheckTest.php index 397333ce29..9a985f3b83 100644 --- a/tests/PHPUnit/Core/DataTable/Filter/RangeCheckTest.php +++ b/tests/PHPUnit/Core/DataTable/Filter/RangeCheckTest.php @@ -5,6 +5,10 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ +use Piwik\DataTable; +use Piwik\DataTable\Filter\RangeCheck; +use Piwik\DataTable\Row; + class DataTable_Filter_RangeCheckTest extends PHPUnit_Framework_TestCase { /** @@ -16,15 +20,15 @@ class DataTable_Filter_RangeCheckTest extends PHPUnit_Framework_TestCase */ public function testRangeCheckNormalDataTable() { - $table = new Piwik_DataTable(); + $table = new DataTable(); $table->addRowsFromArray(array( - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'ask', 'count' => 3)), // --> 5 - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'nintendo', 'count' => 5)), // --> 5 - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'test', 'count' => 7.5)), // --> 7.5 - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'google', 'count' => 9)), // --> 9 - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'yahoo', 'count' => 10.1) // --> 10 + array(Row::COLUMNS => array('label' => 'ask', 'count' => 3)), // --> 5 + array(Row::COLUMNS => array('label' => 'nintendo', 'count' => 5)), // --> 5 + array(Row::COLUMNS => array('label' => 'test', 'count' => 7.5)), // --> 7.5 + array(Row::COLUMNS => array('label' => 'google', 'count' => 9)), // --> 9 + array(Row::COLUMNS => array('label' => 'yahoo', 'count' => 10.1) // --> 10 ))); - $filter = new Piwik_DataTable_Filter_RangeCheck($table, 'count', 5, 10); + $filter = new RangeCheck($table, 'count', 5, 10); $filter->filter($table); $expectedOrder = array(5, 5, 7.5, 9, 10); @@ -40,16 +44,16 @@ class DataTable_Filter_RangeCheckTest extends PHPUnit_Framework_TestCase */ public function testRangeCheckNormalDataTableNonIntegerValues() { - $table = new Piwik_DataTable(); + $table = new DataTable(); $table->addRowsFromArray(array( - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'ask', 'count' => '3')), // 3 is below minimum - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'nintendo', 'count' => 'test')), // no number is below minimum - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'test', 'count' => 0x1232)), // number is over maximum - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'piwik', 'count' => 0x005)), // converted to 5 is ok - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'google', 'count' => '9test')), // converted to 9 is ok, so string will be kept - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'yahoo', 'count' => 'test4') // can't be converted to number + array(Row::COLUMNS => array('label' => 'ask', 'count' => '3')), // 3 is below minimum + array(Row::COLUMNS => array('label' => 'nintendo', 'count' => 'test')), // no number is below minimum + array(Row::COLUMNS => array('label' => 'test', 'count' => 0x1232)), // number is over maximum + array(Row::COLUMNS => array('label' => 'piwik', 'count' => 0x005)), // converted to 5 is ok + array(Row::COLUMNS => array('label' => 'google', 'count' => '9test')), // converted to 9 is ok, so string will be kept + array(Row::COLUMNS => array('label' => 'yahoo', 'count' => 'test4') // can't be converted to number ))); - $filter = new Piwik_DataTable_Filter_RangeCheck($table, 'count', 3.97, 10); + $filter = new RangeCheck($table, 'count', 3.97, 10); $filter->filter($table); $expectedOrder = array(3.97, 3.97, 10, 5, '9test', 3.97); diff --git a/tests/PHPUnit/Core/DataTable/Filter/SortTest.php b/tests/PHPUnit/Core/DataTable/Filter/SortTest.php index eb793bd136..204d98f432 100644 --- a/tests/PHPUnit/Core/DataTable/Filter/SortTest.php +++ b/tests/PHPUnit/Core/DataTable/Filter/SortTest.php @@ -5,6 +5,10 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ +use Piwik\DataTable; +use Piwik\DataTable\Filter\Sort; +use Piwik\DataTable\Row; + class DataTable_Filter_SortTest extends PHPUnit_Framework_TestCase { /** @@ -16,13 +20,13 @@ class DataTable_Filter_SortTest extends PHPUnit_Framework_TestCase */ public function testNormalSortDescending() { - $table = new Piwik_DataTable(); + $table = new DataTable(); $table->addRowsFromArray(array( - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'ask', 'count' => 100)), - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'nintendo', 'count' => 0)), - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'yahoo', 'count' => 10) + array(Row::COLUMNS => array('label' => 'ask', 'count' => 100)), + array(Row::COLUMNS => array('label' => 'nintendo', 'count' => 0)), + array(Row::COLUMNS => array('label' => 'yahoo', 'count' => 10) ))); - $filter = new Piwik_DataTable_Filter_Sort($table, 'count', 'desc'); + $filter = new Sort($table, 'count', 'desc'); $filter->filter($table); $expectedOrder = array('ask', 'yahoo', 'nintendo'); $this->assertEquals($expectedOrder, $table->getColumn('label')); @@ -37,13 +41,13 @@ class DataTable_Filter_SortTest extends PHPUnit_Framework_TestCase */ public function testNormalSortAscending() { - $table = new Piwik_DataTable(); + $table = new DataTable(); $table->addRowsFromArray(array( - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'ask', 'count' => 100.5)), - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'nintendo', 'count' => 0.5)), - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'yahoo', 'count' => 10.5) + array(Row::COLUMNS => array('label' => 'ask', 'count' => 100.5)), + array(Row::COLUMNS => array('label' => 'nintendo', 'count' => 0.5)), + array(Row::COLUMNS => array('label' => 'yahoo', 'count' => 10.5) ))); - $filter = new Piwik_DataTable_Filter_Sort($table, 'count', 'asc'); + $filter = new Sort($table, 'count', 'asc'); $filter->filter($table); $expectedOrder = array('nintendo', 'yahoo', 'ask'); $this->assertEquals($expectedOrder, $table->getColumn('label')); @@ -58,16 +62,16 @@ class DataTable_Filter_SortTest extends PHPUnit_Framework_TestCase */ public function testMissingColumnValuesShouldAppearLastAfterSortAsc() { - $table = new Piwik_DataTable(); + $table = new DataTable(); $table->addRowsFromArray(array( - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'nintendo', 'count' => 1)), - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'nocolumn')), - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'nocolumnbis')), - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'ask', 'count' => 2)), - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'amazing')), - Piwik_DataTable::ID_SUMMARY_ROW => array(Piwik_DataTable_Row::COLUMNS => array('label' => 'summary', 'count' => 10) + array(Row::COLUMNS => array('label' => 'nintendo', 'count' => 1)), + array(Row::COLUMNS => array('label' => 'nocolumn')), + array(Row::COLUMNS => array('label' => 'nocolumnbis')), + array(Row::COLUMNS => array('label' => 'ask', 'count' => 2)), + array(Row::COLUMNS => array('label' => 'amazing')), + DataTable::ID_SUMMARY_ROW => array(Row::COLUMNS => array('label' => 'summary', 'count' => 10) ))); - $filter = new Piwik_DataTable_Filter_Sort($table, 'count', 'asc'); + $filter = new Sort($table, 'count', 'asc'); $filter->filter($table); $expectedOrder = array('nintendo', 'ask', 'amazing', 'nocolumnbis', 'nocolumn', 'summary'); $this->assertEquals($expectedOrder, $table->getColumn('label')); @@ -82,14 +86,14 @@ class DataTable_Filter_SortTest extends PHPUnit_Framework_TestCase */ public function testMissingColumnValuesShouldAppearLastAfterSortDesc() { - $table = new Piwik_DataTable(); + $table = new DataTable(); $table->addRowsFromArray(array( - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'nintendo', 'count' => 1)), - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'ask', 'count' => 2)), - array(Piwik_DataTable_Row::COLUMNS => array('label' => 'amazing')), - Piwik_DataTable::ID_SUMMARY_ROW => array(Piwik_DataTable_Row::COLUMNS => array('label' => 'summary', 'count' => 10) + array(Row::COLUMNS => array('label' => 'nintendo', 'count' => 1)), + array(Row::COLUMNS => array('label' => 'ask', 'count' => 2)), + array(Row::COLUMNS => array('label' => 'amazing')), + DataTable::ID_SUMMARY_ROW => array(Row::COLUMNS => array('label' => 'summary', 'count' => 10) ))); - $filter = new Piwik_DataTable_Filter_Sort($table, 'count', 'desc'); + $filter = new Sort($table, 'count', 'desc'); $filter->filter($table); $expectedOrder = array('ask', 'nintendo', 'amazing', 'summary'); $this->assertEquals($expectedOrder, $table->getColumn('label')); @@ -105,8 +109,8 @@ class DataTable_Filter_SortTest extends PHPUnit_Framework_TestCase */ public function testFilterSortString() { - $idcol = Piwik_DataTable_Row::COLUMNS; - $table = new Piwik_DataTable(); + $idcol = Row::COLUMNS; + $table = new DataTable(); $rows = array( array($idcol => array('label' => 'google')), //0 array($idcol => array('label' => 'ask')), //1 @@ -117,7 +121,7 @@ class DataTable_Filter_SortTest extends PHPUnit_Framework_TestCase array($idcol => array('label' => 'Q*(%&*("$&%*(&"$*")"))')) //6 ); $table->addRowsFromArray($rows); - $expectedtable = new Piwik_DataTable(); + $expectedtable = new DataTable(); $rows = array( array($idcol => array('label' => '238975247578949')), //5 array($idcol => array('label' => 'amazon')), //4 @@ -128,16 +132,16 @@ class DataTable_Filter_SortTest extends PHPUnit_Framework_TestCase array($idcol => array('label' => 'yahoo')) //3 ); $expectedtable->addRowsFromArray($rows); - $expectedtableReverse = new Piwik_DataTable(); + $expectedtableReverse = new DataTable(); $expectedtableReverse->addRowsFromArray(array_reverse($rows)); - $filter = new Piwik_DataTable_Filter_Sort($table, 'label', 'asc'); + $filter = new Sort($table, 'label', 'asc'); $filter->filter($table); - $this->assertTrue(Piwik_DataTable::isEqual($expectedtable, $table)); + $this->assertTrue(DataTable::isEqual($expectedtable, $table)); - $filter = new Piwik_DataTable_Filter_Sort($table, 'label', 'desc'); + $filter = new Sort($table, 'label', 'desc'); $filter->filter($table); - $this->assertTrue(Piwik_DataTable::isEqual($table, $expectedtableReverse)); + $this->assertTrue(DataTable::isEqual($table, $expectedtableReverse)); } /** @@ -150,8 +154,8 @@ class DataTable_Filter_SortTest extends PHPUnit_Framework_TestCase */ public function testFilterSortNumeric() { - $idcol = Piwik_DataTable_Row::COLUMNS; - $table = new Piwik_DataTable(); + $idcol = Row::COLUMNS; + $table = new DataTable(); $rows = array( array($idcol => array('label' => 'google', 'nb_visits' => 897)), //0 array($idcol => array('label' => 'ask', 'nb_visits' => -152)), //1 @@ -162,7 +166,7 @@ class DataTable_Filter_SortTest extends PHPUnit_Framework_TestCase array($idcol => array('label' => 'Q*(%&*', 'nb_visits' => 1)) //6 ); $table->addRowsFromArray($rows); - $expectedtable = new Piwik_DataTable(); + $expectedtable = new DataTable(); $rows = array( array($idcol => array('label' => 'ask', 'nb_visits' => -152)), //1 array($idcol => array('label' => '238949', 'nb_visits' => 0)), //5 @@ -173,15 +177,15 @@ class DataTable_Filter_SortTest extends PHPUnit_Framework_TestCase array($idcol => array('label' => 'google', 'nb_visits' => 897)) //0 ); $expectedtable->addRowsFromArray($rows); - $expectedtableReverse = new Piwik_DataTable(); + $expectedtableReverse = new DataTable(); $expectedtableReverse->addRowsFromArray(array_reverse($rows)); - $filter = new Piwik_DataTable_Filter_Sort($table, 'nb_visits', 'asc'); + $filter = new Sort($table, 'nb_visits', 'asc'); $filter->filter($table); - $this->assertTrue(Piwik_DataTable::isEqual($table, $expectedtable)); + $this->assertTrue(DataTable::isEqual($table, $expectedtable)); - $filter = new Piwik_DataTable_Filter_Sort($table, 'nb_visits', 'desc'); + $filter = new Sort($table, 'nb_visits', 'desc'); $filter->filter($table); - $this->assertTrue(Piwik_DataTable::isEqual($table, $expectedtableReverse)); + $this->assertTrue(DataTable::isEqual($table, $expectedtableReverse)); } } diff --git a/tests/PHPUnit/Core/DataTable/Filter/TruncateTest.php b/tests/PHPUnit/Core/DataTable/Filter/TruncateTest.php index 1d46658e63..c499350066 100644 --- a/tests/PHPUnit/Core/DataTable/Filter/TruncateTest.php +++ b/tests/PHPUnit/Core/DataTable/Filter/TruncateTest.php @@ -5,6 +5,10 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ +use Piwik\DataTable; +use Piwik\DataTable\Filter\Truncate; +use Piwik\DataTable\Row; + class DataTable_Filter_TruncateTest extends PHPUnit_Framework_TestCase { /** @@ -17,20 +21,20 @@ class DataTable_Filter_TruncateTest extends PHPUnit_Framework_TestCase { // remark: this unit test would become invalid and would need to be rewritten if // AddSummaryRow filter stops calling getRowsCount() on the DataTable being filtered. - $mockedDataTable = $this->getMock('Piwik_DataTable', array('getRowsCount')); + $mockedDataTable = $this->getMock('\Piwik\DataTable', array('getRowsCount')); $mockedDataTable->expects($this->never())->method('getRowsCount'); - $dataTableBeingFiltered = new Piwik_DataTable(); - $rowBeingFiltered = new Piwik_DataTable_Row(); + $dataTableBeingFiltered = new DataTable(); + $rowBeingFiltered = new Row(); $dataTableBeingFiltered->addRow($rowBeingFiltered); - // we simulate the fact that the value of Piwik_DataTable_Row::DATATABLE_ASSOCIATED retrieved - // from the database is in conflict with one of the Piwik_DataTable_Manager managed table identifiers. + // we simulate the fact that the value of Row::DATATABLE_ASSOCIATED retrieved + // from the database is in conflict with one of the Manager managed table identifiers. // This is a rare but legitimate case as identifiers are not thoroughly synchronized // when the expanded parameter is false. - $rowBeingFiltered->c[Piwik_DataTable_Row::DATATABLE_ASSOCIATED] = $mockedDataTable->getId(); + $rowBeingFiltered->c[Row::DATATABLE_ASSOCIATED] = $mockedDataTable->getId(); - $filter = new Piwik_DataTable_Filter_Truncate($dataTableBeingFiltered, 1); + $filter = new Truncate($dataTableBeingFiltered, 1); $filter->filter($dataTableBeingFiltered); } @@ -43,22 +47,22 @@ class DataTable_Filter_TruncateTest extends PHPUnit_Framework_TestCase */ public function testForInfiniteRecursion() { - $dataTableBeingFiltered = new Piwik_DataTable(); + $dataTableBeingFiltered = new DataTable(); // remark: this unit test would become invalid and would need to be rewritten if // Truncate filter stops calling getIdSubDataTable() on rows associated with a SubDataTable - $rowBeingFiltered = $this->getMock('Piwik_DataTable_Row', array('getIdSubDataTable')); + $rowBeingFiltered = $this->getMock('Row', array('getIdSubDataTable')); $rowBeingFiltered->expects($this->never())->method('getIdSubDataTable'); $dataTableBeingFiltered->addRow($rowBeingFiltered); - // we simulate a legitimate but rare circular reference between a Piwik_DataTable_Row and its - // enclosing Piwik_DataTable. + // we simulate a legitimate but rare circular reference between a Row and its + // enclosing DataTable. // This can happen because identifiers are not thoroughly synchronized when the expanded parameter // is false. - $rowBeingFiltered->c[Piwik_DataTable_Row::DATATABLE_ASSOCIATED] = $dataTableBeingFiltered->getId(); + $rowBeingFiltered->c[Row::DATATABLE_ASSOCIATED] = $dataTableBeingFiltered->getId(); - $filter = new Piwik_DataTable_Filter_Truncate($dataTableBeingFiltered, 1); + $filter = new Truncate($dataTableBeingFiltered, 1); $filter->filter($dataTableBeingFiltered); } } |