From 0c5b5ead159b75d9b0307e73b17ed2a0c0834594 Mon Sep 17 00:00:00 2001 From: Matthieu Napoli <matthieu@mnapoli.fr> Date: Wed, 29 Oct 2014 14:49:54 +1300 Subject: [PATCH] Speed up unit tests by enabling PHPUnit backupGlobals only for specific tests --- tests/PHPUnit/Unit/AssetManagerTest.php | 2 +- tests/PHPUnit/Unit/CommonTest.php | 2 ++ tests/PHPUnit/Unit/DataTable/Filter/PivotByDimensionTest.php | 3 +++ tests/PHPUnit/Unit/IPTest.php | 2 ++ tests/PHPUnit/Unit/NonceTest.php | 2 ++ tests/PHPUnit/Unit/UrlTest.php | 2 ++ 6 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/PHPUnit/Unit/AssetManagerTest.php b/tests/PHPUnit/Unit/AssetManagerTest.php index 5d3e709004..850e820591 100644 --- a/tests/PHPUnit/Unit/AssetManagerTest.php +++ b/tests/PHPUnit/Unit/AssetManagerTest.php @@ -251,7 +251,7 @@ class AssetManagerTest extends PHPUnit_Framework_TestCase { $this->clearDateCache(); - sleep(1.5); + sleep(1); $modificationDate = $this->mergedAsset->getModificationDate(); diff --git a/tests/PHPUnit/Unit/CommonTest.php b/tests/PHPUnit/Unit/CommonTest.php index 719333ccd9..185fa064d3 100644 --- a/tests/PHPUnit/Unit/CommonTest.php +++ b/tests/PHPUnit/Unit/CommonTest.php @@ -5,6 +5,8 @@ use Piwik\Filesystem; /** * Piwik - free/libre analytics platform * + * @backupGlobals enabled + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ diff --git a/tests/PHPUnit/Unit/DataTable/Filter/PivotByDimensionTest.php b/tests/PHPUnit/Unit/DataTable/Filter/PivotByDimensionTest.php index 9bfa6847ae..f1faa99b88 100644 --- a/tests/PHPUnit/Unit/DataTable/Filter/PivotByDimensionTest.php +++ b/tests/PHPUnit/Unit/DataTable/Filter/PivotByDimensionTest.php @@ -181,6 +181,9 @@ class PivotByDimensionTest extends PHPUnit_Framework_TestCase $this->assertTableRowsEquals($expectedRows, $table); } + /** + * @backupGlobals enabled + */ public function test_filter_UsesCorrectSegment_WhenPivotingSegmentedReport() { $this->loadPlugins('Referrers', 'UserCountry', 'CustomVariables'); diff --git a/tests/PHPUnit/Unit/IPTest.php b/tests/PHPUnit/Unit/IPTest.php index f12d37dfed..ebaf8eb0ff 100644 --- a/tests/PHPUnit/Unit/IPTest.php +++ b/tests/PHPUnit/Unit/IPTest.php @@ -7,6 +7,8 @@ use Piwik\SettingsServer; /** * Piwik - free/libre analytics platform * + * @backupGlobals enabled + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ diff --git a/tests/PHPUnit/Unit/NonceTest.php b/tests/PHPUnit/Unit/NonceTest.php index 9d0d8ef37d..6a9a90994c 100644 --- a/tests/PHPUnit/Unit/NonceTest.php +++ b/tests/PHPUnit/Unit/NonceTest.php @@ -5,6 +5,8 @@ use Piwik\Nonce; /** * Piwik - free/libre analytics platform * + * @backupGlobals enabled + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ diff --git a/tests/PHPUnit/Unit/UrlTest.php b/tests/PHPUnit/Unit/UrlTest.php index bbde992785..3c2bafe73e 100644 --- a/tests/PHPUnit/Unit/UrlTest.php +++ b/tests/PHPUnit/Unit/UrlTest.php @@ -5,6 +5,8 @@ use Piwik\Url; /** * Piwik - free/libre analytics platform * + * @backupGlobals enabled + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -- GitLab