diff options
author | diosmosis <benaka@piwik.pro> | 2014-09-19 21:54:06 +0400 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2014-09-19 21:54:06 +0400 |
commit | 3d9043017c759ed3777b5368dbcbf0bcf873f9a1 (patch) | |
tree | 94e247873c7a594a34c0466b544efac2d44cff4a /tests/PHPUnit/Core | |
parent | 1eefab51d457ba7759bd050c816bdf594bb97b6a (diff) |
Cleaning up PivotByDimensionTest a bit.
Diffstat (limited to 'tests/PHPUnit/Core')
-rw-r--r-- | tests/PHPUnit/Core/DataTable/Filter/PivotByDimensionTest.php | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/tests/PHPUnit/Core/DataTable/Filter/PivotByDimensionTest.php b/tests/PHPUnit/Core/DataTable/Filter/PivotByDimensionTest.php index 4e3bcb63c8..d711d6655c 100644 --- a/tests/PHPUnit/Core/DataTable/Filter/PivotByDimensionTest.php +++ b/tests/PHPUnit/Core/DataTable/Filter/PivotByDimensionTest.php @@ -72,7 +72,7 @@ class PivotByDimensionTest extends PHPUnit_Framework_TestCase */ public function testConstructionFailsWhenReportHasNoSubtableAndSegmentFetchingIsDisabled() { - PluginManager::getInstance()->loadPlugins(array('ExampleReport', 'UserCountry')); + $this->loadPlugins('ExampleReport', 'UserCountry'); new PivotByDimension(new DataTable(), "ExampleReport.GetExampleReport", "UserCountry.City", 'nb_visits', $columnLimit = -1, $enableFetchBySegment = false); } @@ -83,7 +83,7 @@ class PivotByDimensionTest extends PHPUnit_Framework_TestCase */ public function testConstructionFailsWhenDimensionIsNotSubtableAndSegmentFetchingIsDisabled() { - PluginManager::getInstance()->loadPlugins(array('Referrers', 'UserCountry')); + $this->loadPlugins('Referrers', 'UserCountry'); new PivotByDimension(new DataTable(), "Referrers.getKeywords", "UserCountry.City", "nb_visits", $columnLimit = -1, $enableFetchBySegment = false); } @@ -94,7 +94,7 @@ class PivotByDimensionTest extends PHPUnit_Framework_TestCase */ public function testConstructionFailsWhenDimensionIsNotSubtableAndSegmentFetchingIsEnabledButThereIsNoSegment() { - PluginManager::getInstance()->loadPlugins(array('Referrers', 'UserSettings')); + $this->loadPlugins('Referrers', 'UserSettings'); new PivotByDimension(new DataTable(), "UserSettings.getBrowserType", "Referrers.Keyword", "nb_visits"); } @@ -105,7 +105,7 @@ class PivotByDimensionTest extends PHPUnit_Framework_TestCase */ public function testConstructionFailsWhenDimensionDoesNotExist() { - PluginManager::getInstance()->loadPlugins(array('ExampleReport', 'ExampleTracker')); + $this->loadPlugins('ExampleReport', 'ExampleTracker'); new PivotByDimension(new DataTable(), "ExampleReport.GetExampleReport", "ExampleTracker.InvalidDimension", 'nb_visits'); } @@ -116,7 +116,7 @@ class PivotByDimensionTest extends PHPUnit_Framework_TestCase */ public function testConstructionFailsWhenThereIsNoReportForADimension() { - PluginManager::getInstance()->loadPlugins(array('ExampleReport', 'ExampleTracker')); + $this->loadPlugins('ExampleReport', 'ExampleTracker'); new PivotByDimension(new DataTable(), "ExampleReport.GetExampleReport", "ExampleTracker.ExampleDimension", "nb_visits"); } @@ -127,27 +127,26 @@ class PivotByDimensionTest extends PHPUnit_Framework_TestCase */ public function testConstructionFailsWhenSpecifiedReportIsNotValid() { - PluginManager::getInstance()->loadPlugins(array('ExampleReport', 'Referrers')); + $this->loadPlugins('ExampleReport', 'Referrers'); new PivotByDimension(new DataTable(), "ExampleReport.InvalidReport", "Referrers.Keyword", "nb_visits"); } public function testFilterReturnsEmptyResultWhenTableToFilterIsEmpty() { - PluginManager::getInstance()->loadPlugins(array('Referrers', 'UserCountry', 'CustomVariables')); + $this->loadPlugins('Referrers', 'UserCountry', 'CustomVariables'); $table = new DataTable(); $pivotFilter = new PivotByDimension($table, "Referrers.getKeywords", "Referrers.SearchEngine", 'nb_visits'); $pivotFilter->filter($table); - $expectedRows = array(); - $this->assertEquals($expectedRows, $table->getRows()); + $this->assertEquals(array(), $table->getRows()); } public function testFilterCorrectlyCreatesPivotTableUsingSubtableReport() { - PluginManager::getInstance()->loadPlugins(array('Referrers', 'UserCountry', 'CustomVariables')); + $this->loadPlugins('Referrers', 'UserCountry', 'CustomVariables'); $table = $this->getTableToFilter(true); @@ -164,7 +163,7 @@ class PivotByDimensionTest extends PHPUnit_Framework_TestCase public function testFilterCorrectlyCreatesPivotTableUsingSegment() { - PluginManager::getInstance()->loadPlugins(array('Referrers', 'UserCountry', 'CustomVariables')); + $this->loadPlugins('Referrers', 'UserCountry', 'CustomVariables'); $table = $this->getTableToFilter(true); @@ -184,7 +183,7 @@ class PivotByDimensionTest extends PHPUnit_Framework_TestCase public function testFilterUsesCorrectSegmentWhenPivotingSegmentedReport() { - PluginManager::getInstance()->loadPlugins(array('Referrers', 'UserCountry', 'CustomVariables')); + $this->loadPlugins('Referrers', 'UserCountry', 'CustomVariables'); $table = $this->getTableToFilter(true); @@ -203,7 +202,7 @@ class PivotByDimensionTest extends PHPUnit_Framework_TestCase public function testFilterCorrectlyCreatesPivotTableWhenPivotMetricDoesNotExistInTable() { - PluginManager::getInstance()->loadPlugins(array('Referrers', 'UserCountry', 'CustomVariables')); + $this->loadPlugins('Referrers', 'UserCountry', 'CustomVariables'); $table = $this->getTableToFilter(true); @@ -220,7 +219,7 @@ class PivotByDimensionTest extends PHPUnit_Framework_TestCase public function testFilterCorrectlyCreatesPivotTableWhenSubtablesHaveNoRows() { - PluginManager::getInstance()->loadPlugins(array('Referrers', 'UserCountry', 'CustomVariables')); + $this->loadPlugins('Referrers', 'UserCountry', 'CustomVariables'); $table = $this->getTableToFilter(false); @@ -238,7 +237,7 @@ class PivotByDimensionTest extends PHPUnit_Framework_TestCase public function testFilterCorrectlyDefaultsPivotByColumnWhenNoneProvided() { - PluginManager::getInstance()->loadPlugins(array('Referrers', 'UserCountry', 'CustomVariables')); + $this->loadPlugins('Referrers', 'UserCountry', 'CustomVariables'); $table = $this->getTableToFilter(true); @@ -255,7 +254,7 @@ class PivotByDimensionTest extends PHPUnit_Framework_TestCase public function testFilterCorrectlyLimitsTheColumnNumberWhenColumnLimitProvided() { - PluginManager::getInstance()->loadPlugins(array('Referrers', 'UserCountry', 'CustomVariables')); + $this->loadPlugins('Referrers', 'UserCountry', 'CustomVariables'); $table = $this->getTableToFilter(true); @@ -382,4 +381,9 @@ class PivotByDimensionTest extends PHPUnit_Framework_TestCase $this->assertEquals($expectedRows, $actualRows); } + + private function loadPlugins() + { + PluginManager::getInstance()->loadPlugins(func_get_args()); + } }
\ No newline at end of file |