From e342f3fb325776043e115dc00d77488d1c1afcc9 Mon Sep 17 00:00:00 2001 From: diosmosis <benakamoorthi@fastmail.fm> Date: Fri, 18 Oct 2013 23:30:37 -0400 Subject: [PATCH] Fixing tests. --- core/DataTable.php | 13 +++++++------ core/DataTable/Filter/AddSummaryRow.php | 4 ++-- core/DataTable/Filter/GroupBy.php | 2 +- core/DataTable/Row.php | 2 +- core/DataTable/Row/DataTableSummaryRow.php | 2 +- tests/PHPUnit/BaseFixture.php | 1 - 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/DataTable.php b/core/DataTable.php index e985f09b75..211b1837f5 100644 --- a/core/DataTable.php +++ b/core/DataTable.php @@ -485,7 +485,7 @@ class DataTable implements DataTableInterface $this->addRow($row); } } else { - $rowFound->sumRow($row, $copyMeta = true, $this->columnAggregationOperations); + $rowFound->sumRow($row, $copyMeta = true, $this->getMetadata(self::COLUMN_AGGREGATION_OPS_METADATA_NAME)); // if the row to add has a subtable whereas the current row doesn't // we simply add it (cloning the subtable) @@ -494,7 +494,7 @@ class DataTable implements DataTableInterface if (($idSubTable = $row->getIdSubDataTable()) !== null) { $subTable = Manager::getInstance()->getTable($idSubTable); $subTable->metadata[self::COLUMN_AGGREGATION_OPS_METADATA_NAME] - = $this->metadata[self::COLUMN_AGGREGATION_OPS_METADATA_NAME]; + = $this->getMetadata(self::COLUMN_AGGREGATION_OPS_METADATA_NAME); $rowFound->sumSubtable($subTable); } } @@ -644,7 +644,8 @@ class DataTable implements DataTableInterface $columns = array('label' => self::LABEL_SUMMARY_ROW) + $row->getColumns(); $this->addSummaryRow(new Row(array(Row::COLUMNS => $columns))); } else { - $this->summaryRow->sumRow($row, $enableCopyMetadata = false, $this->columnAggregationOperations); + $this->summaryRow->sumRow( + $row, $enableCopyMetadata = false, $this->getMetadata(self::COLUMN_AGGREGATION_OPS_METADATA_NAME)); } return $this->summaryRow; } @@ -762,7 +763,7 @@ class DataTable implements DataTableInterface foreach ($this->getRows() as $row) { $columns = $row->getColumns(); foreach ($columns as $column => $value) { - if (strpos($column, $name) === 0) { + if (strpos($column, $namePrefix) === 0) { $columnValues[] = $row->getColumn($column); } } @@ -1437,7 +1438,7 @@ class DataTable implements DataTableInterface $table = new DataTable(); $table->setMaximumAllowedRows($maxSubtableRows); $table->metadata[self::COLUMN_AGGREGATION_OPS_METADATA_NAME] - = $this->metadata[self::COLUMN_AGGREGATION_OPS_METADATA_NAME]; + = $this->getMetadata(self::COLUMN_AGGREGATION_OPS_METADATA_NAME); $next->setSubtable($table); // Summary row, has no metadata $next->deleteMetadata(); @@ -1480,7 +1481,7 @@ class DataTable implements DataTableInterface if ($existing === false) { $result->addSummaryRow($copy); } else { - $existing->sumRow($copy, $copyMeta = true, $this->columnAggregationOperations); + $existing->sumRow($copy, $copyMeta = true, $this->getMetadata(self::COLUMN_AGGREGATION_OPS_METADATA_NAME)); } } else { if ($labelColumn !== false) { diff --git a/core/DataTable/Filter/AddSummaryRow.php b/core/DataTable/Filter/AddSummaryRow.php index 0a838d5b13..371b6df1fe 100644 --- a/core/DataTable/Filter/AddSummaryRow.php +++ b/core/DataTable/Filter/AddSummaryRow.php @@ -78,10 +78,10 @@ class AddSummaryRow extends Filter //FIXME: I'm not sure why it could return false, but it was reported in: http://forum.piwik.org/read.php?2,89324,page=1#msg-89442 if ($summaryRow) { - $newRow->sumRow($summaryRow, $enableCopyMetadata = false, $table->metadata[DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME]); + $newRow->sumRow($summaryRow, $enableCopyMetadata = false, $table->getMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME)); } } else { - $newRow->sumRow($rows[$i], $enableCopyMetadata = false, $table->metadata[DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME]); + $newRow->sumRow($rows[$i], $enableCopyMetadata = false, $table->getMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME)); } } diff --git a/core/DataTable/Filter/GroupBy.php b/core/DataTable/Filter/GroupBy.php index 0ee3fa6e6c..e6305a43cd 100755 --- a/core/DataTable/Filter/GroupBy.php +++ b/core/DataTable/Filter/GroupBy.php @@ -87,7 +87,7 @@ class GroupBy extends Filter } else { // if we have already encountered this group by value, we add this row to the // row that will be kept, and mark this one for deletion - $groupByRows[$groupByValue]->sumRow($row, $copyMeta = true, $table->metadata[DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME]); + $groupByRows[$groupByValue]->sumRow($row, $copyMeta = true, $table->getMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME)); $nonGroupByRowIds[] = $rowId; } } diff --git a/core/DataTable/Row.php b/core/DataTable/Row.php index 36f057586f..ae9e238ee3 100644 --- a/core/DataTable/Row.php +++ b/core/DataTable/Row.php @@ -288,7 +288,7 @@ class Row $this->addSubtable($thisSubTable); } $thisSubTable->metadata[DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME] - = $subTable->metadata[DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME]; + = $subTable->getMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME); $thisSubTable->addDataTable($subTable); } diff --git a/core/DataTable/Row/DataTableSummaryRow.php b/core/DataTable/Row/DataTableSummaryRow.php index 8603281456..9b47b67df9 100644 --- a/core/DataTable/Row/DataTableSummaryRow.php +++ b/core/DataTable/Row/DataTableSummaryRow.php @@ -59,7 +59,7 @@ class DataTableSummaryRow extends Row private function sumTable($table) { foreach ($table->getRows() as $row) { - $this->sumRow($row, $enableCopyMetadata = false, $table->metadata[DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME]); + $this->sumRow($row, $enableCopyMetadata = false, $table->getMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME)); } } } diff --git a/tests/PHPUnit/BaseFixture.php b/tests/PHPUnit/BaseFixture.php index 1d9c8b731f..3ab347fd31 100644 --- a/tests/PHPUnit/BaseFixture.php +++ b/tests/PHPUnit/BaseFixture.php @@ -383,7 +383,6 @@ abstract class Test_Piwik_BaseFixture extends PHPUnit_Framework_Assert // run the command exec($cmd, $output, $result); - echo "OUTPUT: ".implode("\n", $output); if ($result !== 0) { throw new Exception("log importer failed: " . implode("\n", $output) . "\n\ncommand used: $cmd"); } -- GitLab