diff --git a/core/DataTable.php b/core/DataTable.php index 61e8abb1eb2..895645af0fb 100644 --- a/core/DataTable.php +++ b/core/DataTable.php @@ -356,10 +356,11 @@ public function sort($functionCallback, $columnSortedBy) if ($this->enableRecursiveSort === true) { foreach ($this->getRows() as $row) { - if (($idSubtable = $row->getIdSubDataTable()) !== null) { - $table = Manager::getInstance()->getTable($idSubtable); - $table->enableRecursiveSort(); - $table->sort($functionCallback, $columnSortedBy); + + $subTable = $row->getSubtable(); + if ($subTable) { + $subTable->enableRecursiveSort(); + $subTable->sort($functionCallback, $columnSortedBy); } } } @@ -868,8 +869,8 @@ public function getRowsCountRecursive() { $totalCount = 0; foreach ($this->rows as $row) { - if (($idSubTable = $row->getIdSubDataTable()) !== null) { - $subTable = Manager::getInstance()->getTable($idSubTable); + $subTable = $row->getSubtable(); + if ($subTable) { $count = $subTable->getRowsCountRecursive(); $totalCount += $count; } @@ -907,8 +908,9 @@ public function renameColumn($oldName, $newName, $doRenameColumnsOfSubTables = t $row->renameColumn($oldName, $newName); if ($doRenameColumnsOfSubTables) { - if (($idSubDataTable = $row->getIdSubDataTable()) !== null) { - Manager::getInstance()->getTable($idSubDataTable)->renameColumn($oldName, $newName); + $subTable = $row->getSubtable(); + if ($subTable) { + $subTable->renameColumn($oldName, $newName); } } } @@ -929,8 +931,9 @@ public function deleteColumns($names, $deleteRecursiveInSubtables = false) foreach ($names as $name) { $row->deleteColumn($name); } - if (($idSubDataTable = $row->getIdSubDataTable()) !== null) { - Manager::getInstance()->getTable($idSubDataTable)->deleteColumns($names, $deleteRecursiveInSubtables); + $subTable = $row->getSubtable(); + if ($subTable) { + $subTable->deleteColumns($names, $deleteRecursiveInSubtables); } } if (!is_null($this->summaryRow)) { @@ -1110,20 +1113,13 @@ public function getSerialized($maximumRowsInDataTable = null, // but returns all serialized tables and subtable in an array of 1 dimension $aSerializedDataTable = array(); foreach ($this->rows as $row) { - if (($idSubTable = $row->getIdSubDataTable()) !== null) { - $subTable = null; - try { - $subTable = Manager::getInstance()->getTable($idSubTable); - } catch(TableNotFoundException $e) { - // This occurs is an unknown & random data issue. Catch Exception and remove subtable from the row. - $row->removeSubtable(); - // Go to next row - continue; - } - + $subTable = $row->getSubtable(); + if ($subTable) { $depth++; $aSerializedDataTable = $aSerializedDataTable + $subTable->getSerialized($maximumRowsInSubDataTable, $maximumRowsInSubDataTable, $columnToSortByBeforeTruncation); $depth--; + } else { + $row->removeSubtable(); } } // we load the current Id of the DataTable @@ -1616,8 +1612,8 @@ protected function aggregateRowWithLabel(Row $row, $doAggregateSubTables = true) // we simply add it (cloning the subtable) // if the row has the subtable already // then we have to recursively sum the subtables - if (($idSubTable = $row->getIdSubDataTable()) !== null) { - $subTable = Manager::getInstance()->getTable($idSubTable); + $subTable = $row->getSubtable(); + if ($subTable) { $subTable->metadata[self::COLUMN_AGGREGATION_OPS_METADATA_NAME] = $this->getMetadata(self::COLUMN_AGGREGATION_OPS_METADATA_NAME); $rowFound->sumSubtable($subTable); diff --git a/core/DataTable/BaseFilter.php b/core/DataTable/BaseFilter.php index fb2dc009f9d..dc4756d82ed 100644 --- a/core/DataTable/BaseFilter.php +++ b/core/DataTable/BaseFilter.php @@ -73,8 +73,8 @@ public function filterSubTable(Row $row) if (!$this->enableRecursive) { return; } - if ($row->isSubtableLoaded()) { - $subTable = Manager::getInstance()->getTable($row->getIdSubDataTable()); + $subTable = $row->getSubtable(); + if ($subTable) { $this->filter($subTable); } } diff --git a/core/DataTable/Filter/PatternRecursive.php b/core/DataTable/Filter/PatternRecursive.php index 697403c2e34..f383a132609 100644 --- a/core/DataTable/Filter/PatternRecursive.php +++ b/core/DataTable/Filter/PatternRecursive.php @@ -62,18 +62,15 @@ public function filter($table) // AND 2 - the label is not found in the children $patternNotFoundInChildren = false; - try { - $idSubTable = $row->getIdSubDataTable(); - $subTable = Manager::getInstance()->getTable($idSubTable); - + $subTable = $row->getSubtable(); + if(!$subTable) { + $patternNotFoundInChildren = true; + } else { // we delete the row if we couldn't find the pattern in any row in the // children hierarchy if ($this->filter($subTable) == 0) { $patternNotFoundInChildren = true; } - } catch (Exception $e) { - // there is no subtable loaded for example - $patternNotFoundInChildren = true; } if ($patternNotFoundInChildren diff --git a/core/DataTable/Filter/ReplaceSummaryRowLabel.php b/core/DataTable/Filter/ReplaceSummaryRowLabel.php index 3c1e31e2d0c..1e550f6e3ff 100644 --- a/core/DataTable/Filter/ReplaceSummaryRowLabel.php +++ b/core/DataTable/Filter/ReplaceSummaryRowLabel.php @@ -65,8 +65,8 @@ public function filter($table) // recurse foreach ($rows as $row) { - if ($row->isSubtableLoaded()) { - $subTable = Manager::getInstance()->getTable($row->getIdSubDataTable()); + $subTable = $row->getSubtable(); + if ($subTable) { $this->filter($subTable); } } diff --git a/core/DataTable/Manager.php b/core/DataTable/Manager.php index d225b8fb87a..07e7bc01b2e 100644 --- a/core/DataTable/Manager.php +++ b/core/DataTable/Manager.php @@ -61,7 +61,7 @@ public function addTable($table) public function getTable($idTable) { if (!isset($this->tables[$idTable])) { - throw new TableNotFoundException(sprintf("This report has been reprocessed since your last click. To see this error less often, please increase the timeout value in seconds in Settings > General Settings. (error: id %s not found).", $idTable)); + throw new TableNotFoundException(sprintf("Error: table id %s not found in memory. (If this error is causing you problems in production, please report it in Piwik issue tracker.)", $idTable)); } return $this->tables[$idTable]; diff --git a/core/DataTable/Renderer/Console.php b/core/DataTable/Renderer/Console.php index 0e1c127fb14..a4fcbff0c5a 100644 --- a/core/DataTable/Renderer/Console.php +++ b/core/DataTable/Renderer/Console.php @@ -120,14 +120,10 @@ protected function renderTable($table, $prefix = "") . $row->getIdSubDataTable() . "]
\n"; if (!is_null($row->getIdSubDataTable())) { - if ($row->isSubtableLoaded()) { + $subTable = $row->getSubtable(); + if ($subTable) { $depth++; - $output .= $this->renderTable( - Manager::getInstance()->getTable( - $row->getIdSubDataTable() - ), - $prefix . '      ' - ); + $output .= $this->renderTable($subTable, $prefix . '      '); $depth--; } else { $output .= "-- Sub DataTable not loaded
\n"; diff --git a/core/DataTable/Renderer/Php.php b/core/DataTable/Renderer/Php.php index 56360b939ca..eb6d32a3e3e 100644 --- a/core/DataTable/Renderer/Php.php +++ b/core/DataTable/Renderer/Php.php @@ -206,10 +206,11 @@ protected function renderTable($table) $newRow['issummaryrow'] = true; } + $subTable = $row->getSubtable(); if ($this->isRenderSubtables() - && $row->isSubtableLoaded() + && $subTable ) { - $subTable = $this->renderTable(Manager::getInstance()->getTable($row->getIdSubDataTable())); + $subTable = $this->renderTable($subTable); $newRow['subtable'] = $subTable; if ($this->hideIdSubDatatable === false && isset($newRow['metadata']['idsubdatatable_in_db']) diff --git a/core/DataTable/Row.php b/core/DataTable/Row.php index c6c0d21e9f5..0e7d329d779 100644 --- a/core/DataTable/Row.php +++ b/core/DataTable/Row.php @@ -317,7 +317,11 @@ public function getIdSubDataTable() public function getSubtable() { if ($this->isSubtableLoaded()) { - return Manager::getInstance()->getTable($this->getIdSubDataTable()); + try { + return Manager::getInstance()->getTable($this->getIdSubDataTable()); + } catch(TableNotFoundException $e) { + // edge case + } } return false; } diff --git a/core/DataTable/Row/DataTableSummaryRow.php b/core/DataTable/Row/DataTableSummaryRow.php index 7d477a304ce..2c9eda5e8e0 100644 --- a/core/DataTable/Row/DataTableSummaryRow.php +++ b/core/DataTable/Row/DataTableSummaryRow.php @@ -47,9 +47,8 @@ public function __construct($subTable = null) */ public function recalculate() { - $id = $this->getIdSubDataTable(); - if ($id !== null) { - $subTable = Manager::getInstance()->getTable($id); + $subTable = $this->getSubtable(); + if ($subTable) { $this->sumTable($subTable); } } diff --git a/plugins/Actions/ArchivingHelper.php b/plugins/Actions/ArchivingHelper.php index e168f5d7425..34873eb194a 100644 --- a/plugins/Actions/ArchivingHelper.php +++ b/plugins/Actions/ArchivingHelper.php @@ -198,9 +198,9 @@ public static function deleteInvalidSummedColumnsFromDataTable($dataTable) if (($idSubtable = $row->getIdSubDataTable()) !== null || $id === DataTable::ID_SUMMARY_ROW ) { - if ($idSubtable !== null) { - $subtable = Manager::getInstance()->getTable($idSubtable); - self::deleteInvalidSummedColumnsFromDataTable($subtable); + $subTable = $row->getSubtable(); + if ($subTable) { + self::deleteInvalidSummedColumnsFromDataTable($subTable); } if ($row instanceof DataTableSummaryRow) { diff --git a/plugins/Transitions/API.php b/plugins/Transitions/API.php index 44a39fdcf52..7092fee8f89 100644 --- a/plugins/Transitions/API.php +++ b/plugins/Transitions/API.php @@ -523,8 +523,8 @@ private function addExternalReferrers($logAggregator, &$report, $idaction, $acti if ($visits) { // load details (i.e. subtables) $details = array(); - if ($idSubTable = $row->getIdSubDataTable()) { - $subTable = Manager::getInstance()->getTable($idSubTable); + $subTable = $row->getSubtable(); + if ($subTable) { foreach ($subTable->getRows() as $subRow) { $details[] = array( 'label' => $subRow->getColumn('label'), diff --git a/tests/PHPUnit/Unit/DataTable/Filter/AddSummaryRowTest.php b/tests/PHPUnit/Unit/DataTable/Filter/AddSummaryRowTest.php index f072011675b..b9701a88cde 100644 --- a/tests/PHPUnit/Unit/DataTable/Filter/AddSummaryRowTest.php +++ b/tests/PHPUnit/Unit/DataTable/Filter/AddSummaryRowTest.php @@ -11,6 +11,9 @@ use Piwik\DataTable; use Piwik\DataTable\Row; +/** + * @group DataTableTest + */ class DataTable_Filter_AddSummaryRowTest extends \PHPUnit_Framework_TestCase { /** diff --git a/tests/PHPUnit/Unit/DataTable/Filter/ExcludeLowPopulationTest.php b/tests/PHPUnit/Unit/DataTable/Filter/ExcludeLowPopulationTest.php index 6e8eb733b8c..0f0675114f2 100644 --- a/tests/PHPUnit/Unit/DataTable/Filter/ExcludeLowPopulationTest.php +++ b/tests/PHPUnit/Unit/DataTable/Filter/ExcludeLowPopulationTest.php @@ -12,6 +12,9 @@ use Piwik\DataTable; use Piwik\DataTable\Row; +/** + * @group DataTableTest + */ class DataTable_Filter_ExcludeLowPopulationTest extends \PHPUnit_Framework_TestCase { protected function getTestDataTable() diff --git a/tests/PHPUnit/Unit/DataTable/Filter/LimitTest.php b/tests/PHPUnit/Unit/DataTable/Filter/LimitTest.php index 94d2d4c84be..753220542c8 100644 --- a/tests/PHPUnit/Unit/DataTable/Filter/LimitTest.php +++ b/tests/PHPUnit/Unit/DataTable/Filter/LimitTest.php @@ -12,6 +12,9 @@ use Piwik\DataTable; use Piwik\DataTable\Row; +/** + * @group DataTableTest + */ class DataTable_Filter_LimitTest extends \PHPUnit_Framework_TestCase { /** @@ -39,9 +42,7 @@ protected function getDataTableCount10() return $table; } - /** - * @group Core - */ + public function testNormal() { $offset = 2; @@ -55,9 +56,7 @@ public function testNormal() $this->assertEquals(10, $table->getMetadata(DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME)); } - /** - * @group Core - */ + public function testLimitLessThanCountShouldReturnCountLimit() { $offset = 2; @@ -71,9 +70,7 @@ public function testLimitLessThanCountShouldReturnCountLimit() $this->assertEquals(10, $table->getMetadata(DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME)); } - /** - * @group Core - */ + public function testLimitIsCountShouldNotDeleteAnything() { $offset = 0; @@ -88,9 +85,7 @@ public function testLimitIsCountShouldNotDeleteAnything() $this->assertEquals(10, $table->getMetadata(DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME)); } - /** - * @group Core - */ + public function testLimitGreaterThanCountShouldReturnCountUntilCount() { $offset = 5; @@ -105,9 +100,7 @@ public function testLimitGreaterThanCountShouldReturnCountUntilCount() $this->assertEquals(10, $table->getMetadata(DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME)); } - /** - * @group Core - */ + public function testLimitIsNullShouldReturnCountIsOffset() { $offset = 1; @@ -120,9 +113,7 @@ public function testLimitIsNullShouldReturnCountIsOffset() $this->assertEquals(10, $table->getMetadata(DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME)); } - /** - * @group Core - */ + public function testOffsetJustBeforeSummaryRowShouldJustReturnSummaryRow() { $offset = 9; @@ -136,9 +127,7 @@ public function testOffsetJustBeforeSummaryRowShouldJustReturnSummaryRow() $this->assertEquals(10, $table->getMetadata(DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME)); } - /** - * @group Core - */ + public function testOffsetJustBeforeSummaryRowWithBigLimitShouldJustReturnSummaryRow() { $offset = 9; @@ -152,9 +141,7 @@ public function testOffsetJustBeforeSummaryRowWithBigLimitShouldJustReturnSummar $this->assertEquals(10, $table->getMetadata(DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME)); } - /** - * @group Core - */ + public function testOffsetBeforeSummaryRowShouldJustReturnRowAndSummaryRow() { $offset = 8; @@ -168,9 +155,7 @@ public function testOffsetBeforeSummaryRowShouldJustReturnRowAndSummaryRow() $this->assertEquals(10, $table->getMetadata(DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME)); } - /** - * @group Core - */ + public function testOffsetGreaterThanCountShouldReturnEmptyTable() { $offset = 10; @@ -182,9 +167,7 @@ public function testOffsetGreaterThanCountShouldReturnEmptyTable() $this->assertEquals(10, $table->getMetadata(DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME)); } - /** - * @group Core - */ + public function testLimitIsZeroShouldReturnEmptyTable() { $offset = 0; diff --git a/tests/PHPUnit/Unit/DataTable/Filter/PatternRecursiveTest.php b/tests/PHPUnit/Unit/DataTable/Filter/PatternRecursiveTest.php index 4c9cd46ab3b..8ee9c439ddd 100644 --- a/tests/PHPUnit/Unit/DataTable/Filter/PatternRecursiveTest.php +++ b/tests/PHPUnit/Unit/DataTable/Filter/PatternRecursiveTest.php @@ -11,6 +11,9 @@ use Piwik\DataTable; use Piwik\DataTable\Row; +/** + * @group DataTableTest + */ class DataTable_Filter_PatternRecursiveTest extends \PHPUnit_Framework_TestCase { /** diff --git a/tests/PHPUnit/Unit/DataTable/Filter/PatternTest.php b/tests/PHPUnit/Unit/DataTable/Filter/PatternTest.php index e9d63f1d98a..5c97588a3c2 100644 --- a/tests/PHPUnit/Unit/DataTable/Filter/PatternTest.php +++ b/tests/PHPUnit/Unit/DataTable/Filter/PatternTest.php @@ -11,6 +11,9 @@ use Piwik\DataTable; use Piwik\DataTable\Row; +/** + * @group DataTableTest + */ class DataTable_Filter_PatternTest extends \PHPUnit_Framework_TestCase { /** diff --git a/tests/PHPUnit/Unit/DataTable/Filter/PivotByDimensionTest.php b/tests/PHPUnit/Unit/DataTable/Filter/PivotByDimensionTest.php index f1faa99b88b..8630feca652 100644 --- a/tests/PHPUnit/Unit/DataTable/Filter/PivotByDimensionTest.php +++ b/tests/PHPUnit/Unit/DataTable/Filter/PivotByDimensionTest.php @@ -17,7 +17,7 @@ use Exception; /** - * @group Core + * @group DataTableTest */ class PivotByDimensionTest extends PHPUnit_Framework_TestCase { diff --git a/tests/PHPUnit/Unit/DataTable/Filter/RangeCheckTest.php b/tests/PHPUnit/Unit/DataTable/Filter/RangeCheckTest.php index 3c1d91a3576..0deccd217f8 100644 --- a/tests/PHPUnit/Unit/DataTable/Filter/RangeCheckTest.php +++ b/tests/PHPUnit/Unit/DataTable/Filter/RangeCheckTest.php @@ -12,11 +12,12 @@ use Piwik\DataTable; use Piwik\DataTable\Row; +/** + * @group DataTableTest + */ class DataTable_Filter_RangeCheckTest extends \PHPUnit_Framework_TestCase { - /** - * @group Core - */ + public function testRangeCheckNormalDataTable() { $table = new DataTable(); @@ -34,9 +35,7 @@ public function testRangeCheckNormalDataTable() $this->assertEquals($expectedOrder, $table->getColumn('count')); } - /** - * @group Core - */ + public function testRangeCheckNormalDataTableNonIntegerValues() { $table = new DataTable(); diff --git a/tests/PHPUnit/Unit/DataTable/Filter/SortTest.php b/tests/PHPUnit/Unit/DataTable/Filter/SortTest.php index 64eab67a103..34ec2a2c9a7 100644 --- a/tests/PHPUnit/Unit/DataTable/Filter/SortTest.php +++ b/tests/PHPUnit/Unit/DataTable/Filter/SortTest.php @@ -13,13 +13,11 @@ use Piwik\DataTable\Row; /** - * @group SortTest + * @group DataTableTest */ class DataTable_Filter_SortTest extends \PHPUnit_Framework_TestCase { - /** - * @group Core - */ + public function testNormalSortDescending() { $table = new DataTable(); @@ -34,9 +32,7 @@ public function testNormalSortDescending() $this->assertEquals($expectedOrder, $table->getColumn('label')); } - /** - * @group Core - */ + public function testNormalSortAscending() { $table = new DataTable(); @@ -51,9 +47,7 @@ public function testNormalSortAscending() $this->assertEquals($expectedOrder, $table->getColumn('label')); } - /** - * @group Core - */ + public function testMissingColumnValuesShouldAppearLastAfterSortAsc() { $table = new DataTable(); @@ -71,9 +65,7 @@ public function testMissingColumnValuesShouldAppearLastAfterSortAsc() $this->assertEquals($expectedOrder, $table->getColumn('label')); } - /** - * @group Core - */ + public function testMissingColumnValuesShouldAppearLastAfterSortDesc() { $table = new DataTable(); diff --git a/tests/PHPUnit/Unit/DataTable/Filter/TruncateTest.php b/tests/PHPUnit/Unit/DataTable/Filter/TruncateTest.php index d82e8da4411..b3b5710f91e 100644 --- a/tests/PHPUnit/Unit/DataTable/Filter/TruncateTest.php +++ b/tests/PHPUnit/Unit/DataTable/Filter/TruncateTest.php @@ -12,11 +12,12 @@ use Piwik\DataTable; use Piwik\DataTable\Row; +/** + * @group DataTableTest + */ class DataTable_Filter_TruncateTest extends \PHPUnit_Framework_TestCase { - /** - * @group Core - */ + public function testUnrelatedDataTableNotFiltered() { // remark: this unit test would become invalid and would need to be rewritten if @@ -38,9 +39,7 @@ public function testUnrelatedDataTableNotFiltered() $filter->filter($dataTableBeingFiltered); } - /** - * @group Core - */ + public function testForInfiniteRecursion() { $dataTableBeingFiltered = new DataTable(); @@ -62,9 +61,7 @@ public function testForInfiniteRecursion() $filter->filter($dataTableBeingFiltered); } - /** - * @group Core - */ + public function testOffsetIsCountSummaryRowShouldBeTheRow() { $table = $this->getDataTableCount5(); @@ -74,9 +71,7 @@ public function testOffsetIsCountSummaryRowShouldBeTheRow() $this->assertTrue(Row::isEqual($table->getLastRow(), $this->getRow4())); } - /** - * @group Core - */ + public function testOffsetIsLessThanCountSummaryRowShouldBeTheSum() { $table = $this->getDataTableCount5(); @@ -89,9 +84,7 @@ public function testOffsetIsLessThanCountSummaryRowShouldBeTheSum() $this->assertEquals(array_keys($table->getLastRow()->getColumns()), array_keys($expectedRow->getColumns())); } - /** - * @group Core - */ + public function testOffsetIsMoreThanCountShouldNotTruncate() { $table = $this->getDataTableCount5(); @@ -101,9 +94,7 @@ public function testOffsetIsMoreThanCountShouldNotTruncate() $this->assertTrue(Row::isEqual($table->getLastRow(), $this->getRow4())); } - /** - * @group Core - */ + public function testWhenThereIsAlreadyASummaryRowShouldReplaceTheSummaryRow() { $table = $this->getDataTableCount5(); @@ -116,9 +107,7 @@ public function testWhenThereIsAlreadyASummaryRowShouldReplaceTheSummaryRow() $this->assertTrue(Row::isEqual($table->getLastRow(), $expectedRow)); } - /** - * @group Core - */ + public function testSumTablesWithSummaryRowShouldSumTheSummaryRow() { // row0, row1, row2, rowSummary1 @@ -142,9 +131,7 @@ public function testSumTablesWithSummaryRowShouldSumTheSummaryRow() $this->assertTrue(DataTable::isEqual($expectedTable, $table1)); } - /** - * @group Core - */ + public function testAddOneTableWithSummaryRow() { // row0, row1, row2, rowSummary1 @@ -169,9 +156,7 @@ public function testAddOneTableWithSummaryRow() } - /** - * @group Core - */ + public function testWhenRowsInRandomOrderButSortSpecifiedShouldComputeSummaryRowAfterSort() { $table = new DataTable; diff --git a/tests/PHPUnit/Unit/DataTable/MapTest.php b/tests/PHPUnit/Unit/DataTable/MapTest.php index 659e76ac8fc..179e3f11df0 100644 --- a/tests/PHPUnit/Unit/DataTable/MapTest.php +++ b/tests/PHPUnit/Unit/DataTable/MapTest.php @@ -7,6 +7,9 @@ use Piwik\DataTable; use Piwik\DataTable\Row; +/** + * @group DataTableTest + */ class Test_DataTable_Map extends \PHPUnit_Framework_TestCase { public function setUp() diff --git a/tests/PHPUnit/Unit/DataTable/Renderer/CSVTest.php b/tests/PHPUnit/Unit/DataTable/Renderer/CSVTest.php index 85691cab26f..c6fd94e4066 100644 --- a/tests/PHPUnit/Unit/DataTable/Renderer/CSVTest.php +++ b/tests/PHPUnit/Unit/DataTable/Renderer/CSVTest.php @@ -14,6 +14,9 @@ use Piwik\DataTable\Row; use Piwik\DataTable\Simple; +/** + * @group DataTableTest + */ class DataTable_Renderer_CSVTest extends \PHPUnit_Framework_TestCase { public function setUp() @@ -93,9 +96,7 @@ protected function _getDataTableSimpleOneFalseRowTest() return $table; } - /** - * @group Core - */ + public function testCSVTest1() { $dataTable = $this->_getDataTableTest(); @@ -111,9 +112,7 @@ public function testCSVTest1() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testCSVTest2() { $dataTable = $this->_getDataTableSimpleTest(); @@ -125,9 +124,7 @@ public function testCSVTest2() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testCSVTest3() { $dataTable = $this->_getDataTableSimpleOneRowTest(); @@ -139,9 +136,7 @@ public function testCSVTest3() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testCSVTest5() { $dataTable = $this->_getDataTableSimpleOneZeroRowTest(); @@ -153,9 +148,7 @@ public function testCSVTest5() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testCSVTest4() { $dataTable = $this->_getDataTableEmpty(); @@ -167,9 +160,7 @@ public function testCSVTest4() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testCSVTest6() { $dataTable = $this->_getDataTableSimpleOneFalseRowTest(); @@ -181,9 +172,7 @@ public function testCSVTest6() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testCSVRendererCorrectlyEscapesHeadersAndValues() { $dataTable = $this->_getDataTableSimpleWithCommasInCells(); @@ -301,9 +290,7 @@ protected function _getDataTableMap_containsDataTableMap_simpleOneRow() return $table; } - /** - * @group Core - */ + public function testCSVMapTest1() { $dataTable = $this->_getDataTableMapTest(); @@ -320,9 +307,7 @@ public function testCSVMapTest1() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testCSVMapTest2() { $dataTable = $this->_getDataTableSimpleMapTest(); @@ -335,9 +320,7 @@ public function testCSVMapTest2() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testCSVMapTest3() { $dataTable = $this->_getDataTableSimpleOneRowMapTest(); @@ -349,9 +332,7 @@ public function testCSVMapTest3() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testCSVMapisMadeOfMapTest1() { $dataTable = $this->_getDataTableMap_containsDataTableMap_normal(); @@ -368,9 +349,7 @@ public function testCSVMapisMadeOfMapTest1() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testCSVMapIsMadeOfMapTest2() { $dataTable = $this->_getDataTableMap_containsDataTableMap_simple(); @@ -383,9 +362,7 @@ public function testCSVMapIsMadeOfMapTest2() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testCSVMapIsMadeOfMapTest3() { $dataTable = $this->_getDataTableMap_containsDataTableMap_simpleOneRow(); @@ -397,9 +374,7 @@ public function testCSVMapIsMadeOfMapTest3() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testRenderArray1() { $data = array(); @@ -412,9 +387,7 @@ public function testRenderArray1() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testRenderArray2() { $data = array('a', 'b', 'c'); @@ -429,9 +402,7 @@ public function testRenderArray2() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testRenderArray3() { $data = array('a' => 'b', 'c' => 'd', 'e' => 'f', 5 => 'g'); @@ -445,9 +416,7 @@ public function testRenderArray3() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testRenderArray4() { $data = array('a' => 'b'); diff --git a/tests/PHPUnit/Unit/DataTable/Renderer/ConsoleTest.php b/tests/PHPUnit/Unit/DataTable/Renderer/ConsoleTest.php index 686f6a1be68..209a7a37a7e 100644 --- a/tests/PHPUnit/Unit/DataTable/Renderer/ConsoleTest.php +++ b/tests/PHPUnit/Unit/DataTable/Renderer/ConsoleTest.php @@ -13,6 +13,9 @@ use Piwik\DataTable\Renderer\Console; use Piwik\DataTable\Row; +/** + * @group DataTableTest + */ class DataTable_Renderer_ConsoleTest extends \PHPUnit_Framework_TestCase { public function setUp() @@ -89,9 +92,7 @@ public function testConsoleSimple() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testRenderArray1() { $data = array(); @@ -104,9 +105,7 @@ public function testRenderArray1() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testRenderArray2() { $data = array('a', 'b', 'c'); @@ -121,9 +120,7 @@ public function testRenderArray2() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testRenderArray3() { $data = array('a' => 'b', 'c' => 'd', 'e' => 'f', 5 => 'g'); @@ -136,9 +133,7 @@ public function testRenderArray3() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testRenderArray4() { $data = array('a' => 'b'); diff --git a/tests/PHPUnit/Unit/DataTable/Renderer/JSONTest.php b/tests/PHPUnit/Unit/DataTable/Renderer/JSONTest.php index 738439474c1..754424182ca 100644 --- a/tests/PHPUnit/Unit/DataTable/Renderer/JSONTest.php +++ b/tests/PHPUnit/Unit/DataTable/Renderer/JSONTest.php @@ -14,6 +14,9 @@ use Piwik\DataTable\Row; use Piwik\DataTable\Simple; +/** + * @group DataTableTest + */ class DataTable_Renderer_JSONTest extends \PHPUnit_Framework_TestCase { public function setUp() @@ -93,9 +96,7 @@ protected function _getDataTableSimpleOneFalseRowTest() return $table; } - /** - * @group Core - */ + public function testJSONTest1() { $dataTable = $this->_getDataTableTest(); @@ -108,9 +109,7 @@ public function testJSONTest1() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testJSONTest2() { $dataTable = $this->_getDataTableSimpleTest(); @@ -121,9 +120,7 @@ public function testJSONTest2() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testJSONTest3() { $dataTable = $this->_getDataTableSimpleOneRowTest(); @@ -133,9 +130,7 @@ public function testJSONTest3() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testJSONTest4() { $dataTable = $this->_getDataTableEmpty(); @@ -145,9 +140,7 @@ public function testJSONTest4() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testJSONTest5() { $dataTable = $this->_getDataTableSimpleOneZeroRowTest(); @@ -157,9 +150,7 @@ public function testJSONTest5() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testJSONTest6() { $dataTable = $this->_getDataTableSimpleOneFalseRowTest(); @@ -274,9 +265,7 @@ protected function _getDataTableMap_containsDataTableMap_simpleOneRow() return $table; } - /** - * @group Core - */ + public function testJSONArrayTest1() { $dataTable = $this->_getDataTableMapTest(); @@ -288,9 +277,7 @@ public function testJSONArrayTest1() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testJSONMapTest2() { $dataTable = $this->_getDataTableSimpleMapTest(); @@ -303,9 +290,7 @@ public function testJSONMapTest2() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testJSONMapTest3() { $dataTable = $this->_getDataTableSimpleOneRowMapTest(); @@ -317,9 +302,7 @@ public function testJSONMapTest3() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testJSONMapIsMadeOfMapTest1() { $dataTable = $this->_getDataTableMap_containsDataTableMap_normal(); @@ -330,9 +313,7 @@ public function testJSONMapIsMadeOfMapTest1() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testJSONMapIsMadeOfMapTest2() { $dataTable = $this->_getDataTableMap_containsDataTableMap_simple(); @@ -345,9 +326,7 @@ public function testJSONMapIsMadeOfMapTest2() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testJSONMapIsMadeOfMapTest3() { $dataTable = $this->_getDataTableMap_containsDataTableMap_simpleOneRow(); @@ -359,9 +338,7 @@ public function testJSONMapIsMadeOfMapTest3() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testRenderArray1() { $data = array(); @@ -373,9 +350,7 @@ public function testRenderArray1() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testRenderArray2() { $data = array('a', 'b', 'c', array('a' => 'b'), array(1, 2)); @@ -387,9 +362,7 @@ public function testRenderArray2() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testRenderArray3() { $data = array('a' => 'b', 'c' => 'd', 'e' => 'f', 5 => 'g'); @@ -401,9 +374,7 @@ public function testRenderArray3() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testRenderArray4() { $data = array('a' => 'b', 'c' => array(1, 2, 3, 4), 'e' => array('f' => 'g', 'h' => 'i', 'j' => 'k')); @@ -415,9 +386,7 @@ public function testRenderArray4() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testRenderArray5() { $data = array('a' => 'b'); diff --git a/tests/PHPUnit/Unit/DataTable/Renderer/PHPTest.php b/tests/PHPUnit/Unit/DataTable/Renderer/PHPTest.php index e3201dfbe6b..de8128cfb9a 100644 --- a/tests/PHPUnit/Unit/DataTable/Renderer/PHPTest.php +++ b/tests/PHPUnit/Unit/DataTable/Renderer/PHPTest.php @@ -14,6 +14,9 @@ use Piwik\DataTable\Row; use Piwik\DataTable\Simple; +/** + * @group DataTableTest + */ class DataTable_Renderer_PHPTest extends \PHPUnit_Framework_TestCase { public function setUp() @@ -93,9 +96,7 @@ protected function _getDataTableSimpleOneFalseRowTest() return $table; } - /** - * @group Core - */ + public function testPHPTest1() { $dataTable = $this->_getDataTableTest(); @@ -157,9 +158,7 @@ public function testPHPTest1() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testPHPTest2() { $dataTable = $this->_getDataTableSimpleTest(); @@ -176,9 +175,7 @@ public function testPHPTest2() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testPHPTest3() { $dataTable = $this->_getDataTableSimpleOneRowTest(); @@ -188,9 +185,7 @@ public function testPHPTest3() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testPHPTest4() { $dataTable = $this->_getDataTableEmpty(); @@ -200,9 +195,7 @@ public function testPHPTest4() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testPHPTest5() { $dataTable = $this->_getDataTableSimpleOneZeroRowTest(); @@ -212,9 +205,7 @@ public function testPHPTest5() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testPHPTest6() { $dataTable = $this->_getDataTableSimpleOneFalseRowTest(); @@ -329,9 +320,7 @@ protected function _getDataTableMap_containsDataTableMap_simpleOneRow() return $table; } - /** - * @group Core - */ + public function testPHPMapTest1() { $dataTable = $this->_getDataTableMapTest(); @@ -383,9 +372,7 @@ public function testPHPMapTest1() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testPHPMapTest2() { $dataTable = $this->_getDataTableSimpleMapTest(); @@ -410,9 +397,7 @@ public function testPHPMapTest2() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testPHPMapTest3() { $dataTable = $this->_getDataTableSimpleOneRowMapTest(); @@ -428,9 +413,7 @@ public function testPHPMapTest3() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testPHPMapIsMadeOfMapTest1() { $dataTable = $this->_getDataTableMap_containsDataTableMap_normal(); @@ -484,9 +467,7 @@ public function testPHPMapIsMadeOfMapTest1() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testPHPMapIsMadeOfMapTest2() { $dataTable = $this->_getDataTableMap_containsDataTableMap_simple(); @@ -512,9 +493,7 @@ public function testPHPMapIsMadeOfMapTest2() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testPHPMapIsMadeOfMapTest3() { $dataTable = $this->_getDataTableMap_containsDataTableMap_simpleOneRow(); diff --git a/tests/PHPUnit/Unit/DataTable/Renderer/XMLTest.php b/tests/PHPUnit/Unit/DataTable/Renderer/XMLTest.php index 1abfe94b06c..e9b02a9bd13 100644 --- a/tests/PHPUnit/Unit/DataTable/Renderer/XMLTest.php +++ b/tests/PHPUnit/Unit/DataTable/Renderer/XMLTest.php @@ -14,6 +14,9 @@ use Piwik\DataTable\Row; use Piwik\DataTable\Simple; +/** + * @group DataTableTest + */ class DataTable_Renderer_XMLTest extends \PHPUnit_Framework_TestCase { public function setUp() @@ -93,9 +96,7 @@ protected function _getDataTableSimpleOneFalseRowTest() return $table; } - /** - * @group Core - */ + public function testXMLTest1() { $dataTable = $this->_getDataTableTest(); @@ -152,9 +153,7 @@ public function testXMLTest1() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testXMLTest2() { $dataTable = $this->_getDataTableSimpleTest(); @@ -172,9 +171,7 @@ public function testXMLTest2() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testXMLTest3() { $dataTable = $this->_getDataTableSimpleOneRowTest(); @@ -185,9 +182,7 @@ public function testXMLTest3() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testXMLTest4() { $dataTable = $this->_getDataTableEmpty(); @@ -198,9 +193,7 @@ public function testXMLTest4() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testXMLTest5() { $dataTable = $this->_getDataTableSimpleOneZeroRowTest(); @@ -211,9 +204,7 @@ public function testXMLTest5() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testXMLTest6() { $dataTable = $this->_getDataTableSimpleOneFalseRowTest(); @@ -224,9 +215,7 @@ public function testXMLTest6() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testXMLRendererSuccessfullyRendersWhenSimpleDataTableColumnsHaveInvalidXmlCharacters() { $dataTable = $this->_getDataTableSimpleWithInvalidChars(); @@ -241,9 +230,7 @@ public function testXMLRendererSuccessfullyRendersWhenSimpleDataTableColumnsHave $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testXMLRendererSuccessfullyRendersWhenDataTableColumnsHaveInvalidXmlCharacters() { $dataTable = $this->_getDataTableWithInvalidChars(); @@ -365,9 +352,7 @@ protected function _getDataTableMap_containsDataTableMap_simpleOneRow() return $table; } - /** - * @group Core - */ + public function testXMLMapTest1() { $dataTable = $this->_getDataTableMapTest(); @@ -412,9 +397,7 @@ public function testXMLMapTest1() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testXMLArrayIsMadeOfMapTest1() { $dataTable = $this->_getDataTableMap_containsDataTableMap_normal(); @@ -463,9 +446,7 @@ public function testXMLArrayIsMadeOfMapTest1() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testXMLMapTest2() { $dataTable = $this->_getDataTableSimpleMapTest(); @@ -487,9 +468,7 @@ public function testXMLMapTest2() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testXMLArrayIsMadeOfMapTest2() { $dataTable = $this->_getDataTableMap_containsDataTableMap_simple(); @@ -513,9 +492,7 @@ public function testXMLArrayIsMadeOfMapTest2() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testXMLMapTest3() { $dataTable = $this->_getDataTableSimpleOneRowMapTest(); @@ -532,9 +509,7 @@ public function testXMLMapTest3() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testXMLArrayIsMadeOfMapTest3() { $dataTable = $this->_getDataTableMap_containsDataTableMap_simpleOneRow(); @@ -552,9 +527,7 @@ public function testXMLArrayIsMadeOfMapTest3() $this->assertEquals($expected, $rendered); } - /** - * @group Core - */ + public function testRenderArray1() { $data = array(); @@ -567,9 +540,7 @@ public function testRenderArray1() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testRenderArray2() { $data = array("firstElement", @@ -592,9 +563,7 @@ public function testRenderArray2() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testRenderArray3() { $data = array('a' => 'b', 'c' => 'd', 'e' => 'f', 5 => 'g'); @@ -614,9 +583,7 @@ public function testRenderArray3() $this->assertEquals($expected, $render->render()); } - /** - * @group Core - */ + public function testRenderArray4() { $data = array('c' => array(1, 2, 3, 4), 'e' => array('f' => 'g', 'h' => 'i', 'j' => 'k')); diff --git a/tests/PHPUnit/Unit/DataTable/RowTest.php b/tests/PHPUnit/Unit/DataTable/RowTest.php index 53a072fa361..7033299df57 100644 --- a/tests/PHPUnit/Unit/DataTable/RowTest.php +++ b/tests/PHPUnit/Unit/DataTable/RowTest.php @@ -12,7 +12,7 @@ use Piwik\DataTable\Row; /** - * @group Core + * @group DataTableTest */ class RowTest extends \PHPUnit_Framework_TestCase { diff --git a/tests/PHPUnit/Unit/DataTableTest.php b/tests/PHPUnit/Unit/DataTableTest.php index 30320f32ce1..b36dbd51461 100644 --- a/tests/PHPUnit/Unit/DataTableTest.php +++ b/tests/PHPUnit/Unit/DataTableTest.php @@ -14,6 +14,9 @@ use Piwik\DataTable; use Piwik\Timer; +/** + * @group DataTableTest + */ class DataTableTest extends \PHPUnit_Framework_TestCase { /**