diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2015-07-28 19:12:52 +0300 |
---|---|---|
committer | sgiehl <stefan@piwik.org> | 2015-10-06 17:23:54 +0300 |
commit | d8cd9454d4f213acfb8df0d155fc4da9ae0a7a81 (patch) | |
tree | bd96523f4bae4cf38210f276ff84a91e23c57cf0 /tests | |
parent | e30de3346a74ea908ee1e9944dbc5686016e11a4 (diff) |
starting to prepare the requirement of php 5.4
Diffstat (limited to 'tests')
13 files changed, 43 insertions, 112 deletions
diff --git a/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php b/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php index c413635c8e..9db794269d 100644 --- a/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php +++ b/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php @@ -268,10 +268,6 @@ class ManyVisitsWithGeoIP extends Fixture // also fails on other PHP, is it really needed? return; - // this randomly fails on PHP 5.3 - if(strpos(PHP_VERSION, '5.3') === 0) { - return; - } try { LocationProvider::setCurrentProvider('default'); } catch(Exception $e) { diff --git a/tests/PHPUnit/Framework/TestCase/SystemTestCase.php b/tests/PHPUnit/Framework/TestCase/SystemTestCase.php index 7797751b9f..8446a66d16 100755 --- a/tests/PHPUnit/Framework/TestCase/SystemTestCase.php +++ b/tests/PHPUnit/Framework/TestCase/SystemTestCase.php @@ -101,11 +101,6 @@ abstract class SystemTestCase extends PHPUnit_Framework_TestCase return !empty($travis); } - public static function isPhpVersion53() - { - return strpos(PHP_VERSION, '5.3') === 0; - } - public static function isPhp7orLater() { return version_compare('7.0.0-dev', PHP_VERSION) < 1; @@ -601,13 +596,6 @@ abstract class SystemTestCase extends PHPUnit_Framework_TestCase DbHelper::deleteArchiveTables(); } - protected function skipWhenPhp53() - { - if(self::isPhpVersion53()) { - $this->markTestSkipped('Sometimes fail on php 5.3'); - } - } - public function assertHttpResponseText($expectedResponseText, $url, $message = '') { self::assertThat($url, new HttpResponseText($expectedResponseText), $message); diff --git a/tests/PHPUnit/Framework/TestRequest/Response.php b/tests/PHPUnit/Framework/TestRequest/Response.php index 5f8aea369e..6d729ca941 100644 --- a/tests/PHPUnit/Framework/TestRequest/Response.php +++ b/tests/PHPUnit/Framework/TestRequest/Response.php @@ -120,10 +120,6 @@ class Response private function normalizeEncodingPhp533($apiResponse) { - if (!SystemTestCase::isPhpVersion53() - || strpos($apiResponse, '<result') === false) { - return $apiResponse; - } return str_replace('&#039;', "'", $apiResponse); } diff --git a/tests/PHPUnit/Integration/Plugin/SettingsTest.php b/tests/PHPUnit/Integration/Plugin/SettingsTest.php index f5ac688d31..679b84ccba 100644 --- a/tests/PHPUnit/Integration/Plugin/SettingsTest.php +++ b/tests/PHPUnit/Integration/Plugin/SettingsTest.php @@ -189,7 +189,6 @@ class SettingsTest extends IntegrationTestCase public function test_getSettingsForCurrentUser_shouldReturnAllSettingsIfEnoughPermissionsAndSortThemBySettingOrder() { - $this->skipWhenPhp53(); $this->setSuperUser(); $this->addSystemSetting('mysystemsetting1', 'mytitle1'); diff --git a/tests/PHPUnit/System/ArchiveCronTest.php b/tests/PHPUnit/System/ArchiveCronTest.php index db722f9266..dcdf8ca5e1 100644 --- a/tests/PHPUnit/System/ArchiveCronTest.php +++ b/tests/PHPUnit/System/ArchiveCronTest.php @@ -78,10 +78,6 @@ class ArchiveCronTest extends SystemTestCase public function testArchivePhpCron() { - if(self::isPhpVersion53()) { - $this->markTestSkipped('Fails on PHP 5.3 once in a blue moon.'); - } - $this->setLastRunArchiveOptions(); $output = $this->runArchivePhpCron(); diff --git a/tests/PHPUnit/System/AutoSuggestAPITest.php b/tests/PHPUnit/System/AutoSuggestAPITest.php index 2ec2900f5e..2cb5e0282d 100644 --- a/tests/PHPUnit/System/AutoSuggestAPITest.php +++ b/tests/PHPUnit/System/AutoSuggestAPITest.php @@ -41,10 +41,6 @@ class AutoSuggestAPITest extends SystemTestCase // Refresh cache for CustomVariables\Model Cache::clearCacheGeneral(); - if(self::isPhpVersion53() && self::isTravisCI()) { - $this->markTestSkipped("Skipping this test as it seg faults on php 5.3 (bug triggered on travis)"); - } - $this->runApiTests($api, $params); } diff --git a/tests/PHPUnit/System/CliMultiTest.php b/tests/PHPUnit/System/CliMultiTest.php index 55e95e0066..23ea2e68a3 100644 --- a/tests/PHPUnit/System/CliMultiTest.php +++ b/tests/PHPUnit/System/CliMultiTest.php @@ -83,7 +83,6 @@ class CliMultiTest extends SystemTestCase public function test_request_shouldRunAsync() { - $this->skipWhenPhp53(); $this->assertTrue($this->cliMulti->supportsAsync); } @@ -143,7 +142,6 @@ class CliMultiTest extends SystemTestCase */ public function test_request_shouldDetectFinishOfRequest_IfNoParamsAreGiven() { - $this->skipWhenPhp53(); $this->cliMulti->runAsSuperUser(); $response = $this->cliMulti->request(array($this->completeUrl(''))); $this->assertStringStartsWith('Error in Piwik: Error: no website was found', $response[0]); @@ -151,7 +149,6 @@ class CliMultiTest extends SystemTestCase public function test_request_shouldBeAbleToRenderARegularPageInPiwik() { - $this->skipWhenPhp53(); Fixture::createWebsite('2014-01-01 00:00:00'); $urls = array($this->completeUrl('/?module=Widgetize&idSite=1&period=day&date=today')); diff --git a/tests/PHPUnit/System/ManyVisitorsOneWebsiteTest.php b/tests/PHPUnit/System/ManyVisitorsOneWebsiteTest.php index 35daba0b5d..d1301d728a 100755 --- a/tests/PHPUnit/System/ManyVisitorsOneWebsiteTest.php +++ b/tests/PHPUnit/System/ManyVisitorsOneWebsiteTest.php @@ -115,54 +115,48 @@ class ManyVisitorsOneWebsiteTest extends SystemTestCase )), ); - // Randomly fails on 5.3 - if(!self::isPhpVersion53()) { - - $apiToTest[] = array('Live.getLastVisitsDetails', array( - 'idSite' => $idSite, - 'date' => $dateString, - 'periods' => 'month', - 'testSuffix' => '_Live.getLastVisitsDetails_sortDesc', - 'otherRequestParameters' => array('filter_sort_order' => 'desc', 'filter_limit' => 7) - )); - - // #5950 - $apiToTest[] = array('Live.getLastVisitsDetails', array( - 'idSite' => $idSite, - 'date' => $dateString, - 'periods' => 'month', - 'testSuffix' => '_Live.getLastVisitsDetails_sortByIdVisit', - 'otherRequestParameters' => array('filter_sort_order' => 'desc', 'filter_sort_column' => 'idVisit', 'filter_limit' => 7) - )); - - // #7458 - $apiToTest[] = array('Live.getLastVisitsDetails', array( - 'idSite' => $idSite, - 'date' => $dateString, - 'periods' => 'month', - 'testSuffix' => '_Live.getLastVisitsDetails_offsetAndLimit_1', - 'otherRequestParameters' => array('filter_offset' => '1', 'filter_limit' => 3) - )); - $apiToTest[] = array('Live.getLastVisitsDetails', array( - 'idSite' => $idSite, - 'date' => $dateString, - 'periods' => 'month', - 'testSuffix' => '_Live.getLastVisitsDetails_offsetAndLimit_2', - 'otherRequestParameters' => array('filter_offset' => '4', 'filter_limit' => 3) - )); - - // #8324 - // testing filter_excludelowpop and filter_excludelowpop_value - $apiToTest[] = array('UserCountry.getCountry', array( - 'idSite' => $idSite, - 'date' => $dateString, - 'periods' => 'month', - 'testSuffix' => '_getCountry_with_filter_excludelowpop', - 'otherRequestParameters' => array('filter_excludelowpop' => 'nb_visits', 'filter_excludelowpop_value' => 5) - )); - - - } + $apiToTest[] = array('Live.getLastVisitsDetails', array( + 'idSite' => $idSite, + 'date' => $dateString, + 'periods' => 'month', + 'testSuffix' => '_Live.getLastVisitsDetails_sortDesc', + 'otherRequestParameters' => array('filter_sort_order' => 'desc', 'filter_limit' => 7) + )); + + // #5950 + $apiToTest[] = array('Live.getLastVisitsDetails', array( + 'idSite' => $idSite, + 'date' => $dateString, + 'periods' => 'month', + 'testSuffix' => '_Live.getLastVisitsDetails_sortByIdVisit', + 'otherRequestParameters' => array('filter_sort_order' => 'desc', 'filter_sort_column' => 'idVisit', 'filter_limit' => 7) + )); + + // #7458 + $apiToTest[] = array('Live.getLastVisitsDetails', array( + 'idSite' => $idSite, + 'date' => $dateString, + 'periods' => 'month', + 'testSuffix' => '_Live.getLastVisitsDetails_offsetAndLimit_1', + 'otherRequestParameters' => array('filter_offset' => '1', 'filter_limit' => 3) + )); + $apiToTest[] = array('Live.getLastVisitsDetails', array( + 'idSite' => $idSite, + 'date' => $dateString, + 'periods' => 'month', + 'testSuffix' => '_Live.getLastVisitsDetails_offsetAndLimit_2', + 'otherRequestParameters' => array('filter_offset' => '4', 'filter_limit' => 3) + )); + + // #8324 + // testing filter_excludelowpop and filter_excludelowpop_value + $apiToTest[] = array('UserCountry.getCountry', array( + 'idSite' => $idSite, + 'date' => $dateString, + 'periods' => 'month', + 'testSuffix' => '_getCountry_with_filter_excludelowpop', + 'otherRequestParameters' => array('filter_excludelowpop' => 'nb_visits', 'filter_excludelowpop_value' => 5) + )); // this also fails on all PHP versions, it seems randomly. // $apiToTest[] = array('Live.getLastVisitsDetails', array( diff --git a/tests/PHPUnit/System/PivotByQueryParamTest.php b/tests/PHPUnit/System/PivotByQueryParamTest.php index 099f82fcf6..f30fd5c555 100644 --- a/tests/PHPUnit/System/PivotByQueryParamTest.php +++ b/tests/PHPUnit/System/PivotByQueryParamTest.php @@ -198,10 +198,6 @@ class PivotByQueryParamTest extends SystemTestCase } public function assertApiResponseEqualsExpected($apiMethod, $queryParams) { - if(self::isPhpVersion53()) { - // 5.3.3 space encoding fail eg. https://travis-ci.org/piwik/piwik/jobs/35920420 - $this->markTestSkipped(); - } parent::assertApiResponseEqualsExpected($apiMethod, $queryParams); } } diff --git a/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysArchivingDisabledTest.php b/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysArchivingDisabledTest.php index 5e4c04a7d8..ae4c167010 100755 --- a/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysArchivingDisabledTest.php +++ b/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysArchivingDisabledTest.php @@ -26,9 +26,6 @@ class TwoVisitorsTwoWebsitesDifferentDaysArchivingDisabledTest extends SystemTes */ public function testApi($api, $params) { - if (self::isPhpVersion53() && self::isTravisCI()) { - $this->markTestSkipped("Skipping this test as it often fails on travis)"); - } $this->runApiTests($api, $params); } diff --git a/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysConversionsTest.php b/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysConversionsTest.php index 7e9a576b71..12cb4b15f8 100755 --- a/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysConversionsTest.php +++ b/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysConversionsTest.php @@ -38,8 +38,6 @@ class TwoVisitorsTwoWebsitesDifferentDaysConversionsTest extends SystemTestCase */ public function testApi($api, $params) { - $this->markTestSkippedOnPhp53(); - $this->runApiTests($api, $params); } @@ -126,8 +124,6 @@ class TwoVisitorsTwoWebsitesDifferentDaysConversionsTest extends SystemTestCase // plugins is non-trivial, so not done now. public function test_Archive_getNumeric_ReturnsMetricsFromDifferentPlugins_WhenThoseMetricsAreRequested() { - $this->markTestSkippedOnPhp53(); - // Tests that getting a visits summary metric (nb_visits) & a Goal's metric (Goal_revenue) // at the same time works. $dateTimeRange = '2010-01-03,2010-01-06'; @@ -149,8 +145,6 @@ class TwoVisitorsTwoWebsitesDifferentDaysConversionsTest extends SystemTestCase // plugins is non-trivial, so not done now. public function test_Archive_getNumeric_shouldInvalidateRememberedReportsOncePerRequestIfNeeded() { - $this->markTestSkippedOnPhp53(); - // Tests that getting a visits summary metric (nb_visits) & a Goal's metric (Goal_revenue) // at the same time works. $dateTimeRange = '2010-01-03,2010-01-06'; @@ -219,13 +213,6 @@ class TwoVisitorsTwoWebsitesDifferentDaysConversionsTest extends SystemTestCase { return 'TwoVisitors_twoWebsites_differentDays_Conversions'; } - - private function markTestSkippedOnPhp53() - { - if (self::isPhpVersion53() && self::isTravisCI()) { - $this->markTestSkipped("Skipping this test as it often fails on travis)"); - } - } } TwoVisitorsTwoWebsitesDifferentDaysConversionsTest::$fixture = new TwoSitesTwoVisitorsDifferentDays(); diff --git a/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysTest.php b/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysTest.php index 9e0d567e6b..43335c0e81 100755 --- a/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysTest.php +++ b/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysTest.php @@ -37,9 +37,6 @@ class TwoVisitorsTwoWebsitesDifferentDaysTest extends SystemTestCase */ public function testApi($api, $params) { - if(self::isTravisCI() && self::isPhpVersion53()) { - $this->markTestSkipped('This test fails on travis eg. https://travis-ci.org/piwik/piwik/jobs/46944264'); - } $this->runApiTests($api, $params); } diff --git a/tests/PHPUnit/Unit/UrlHelperTest.php b/tests/PHPUnit/Unit/UrlHelperTest.php index e972d20d54..c3cd578a65 100644 --- a/tests/PHPUnit/Unit/UrlHelperTest.php +++ b/tests/PHPUnit/Unit/UrlHelperTest.php @@ -220,14 +220,6 @@ class UrlHelperTest extends \PHPUnit_Framework_TestCase $this->assertEquals('localhost', UrlHelper::getHostFromUrl('localhost/path')); $this->assertEquals('sub.localhost', UrlHelper::getHostFromUrl('sub.localhost/path')); $this->assertEquals('sub.localhost', UrlHelper::getHostFromUrl('http://sub.localhost/path/?query=test')); - - if(SystemTestCase::isPhpVersion53()) { - //parse_url was fixed in 5,4,7 - // Fixed host recognition when scheme is omitted and a leading component separator is present. - // http://php.net/parse_url - return; - } - $this->assertEquals('localhost', UrlHelper::getHostFromUrl('//localhost/path')); $this->assertEquals('localhost', UrlHelper::getHostFromUrl('//localhost/path?test=test2')); $this->assertEquals('example.org', UrlHelper::getHostFromUrl('//example.org/path')); @@ -264,4 +256,4 @@ class UrlHelperTest extends \PHPUnit_Framework_TestCase $this->assertEquals('add=foo', UrlHelper::getQueryFromUrl('/', array('add' => 'foo'))); $this->assertEquals('add[]=foo&add[]=test', UrlHelper::getQueryFromUrl('/', array('add' => array('foo', 'test')))); } -}
\ No newline at end of file +} |