From 331ba65dc43ae7ce5090e46bd2cb0512607f46c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20R?= Date: Thu, 14 Apr 2016 13:43:48 +0200 Subject: [PATCH 1/8] Update travis to test on php7 also Might fail on a few things. --- .travis.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6c8d939a..86c3dca0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ php: - 5.4 - 5.5 - 5.6 + - 7.0 # test only master (+ Pull requests) branches: @@ -15,15 +16,15 @@ branches: # setup requirements for running unit tests before_script: # Get latests version of composer which is faster (and to attempt to avoid memory issues with legacy package) - - composer self-update + - travis_retry composer self-update # Disable xdebug to speed things up as we don't currently generate coverge on travis - if [ $TRAVIS_PHP_VERSION != "hhvm" ]; then phpenv config-rm xdebug.ini ; fi # Avoid issues on composer install since we pull in both legacy and platform stack - echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - # Setup github key to avoid api rate limit - - ./composer_install_github_key.sh + # Setup github key to avoid api rate limit (pure auth read only key, no rights, for use in ezsystems repos only) + - composer config -g github-oauth.github.com "d0285ed5c8644f30547572ead2ed897431c1fc09" # Install packages using composer - - composer install --dev --prefer-dist + - travis_retry composer install --dev --prefer-dist # Copy default test configuration - cp config.php-DEVELOPMENT config.php @@ -31,7 +32,7 @@ before_script: script: "./bin/phpunit -d date.timezone='America/New_York' -d memory_limit=-1" # disable mail notifications -notification: +notifications: email: false # reduce depth (history) of git checkout From e3dce52527c8ef949b49a0b538cdfa1d2cb6aec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20R?= Date: Thu, 14 Apr 2016 17:26:51 +0200 Subject: [PATCH 2/8] [PHP7] Change EzPublishLegacyExtension to not expect referance Not needed in this case as it is not modified, and value given. --- bundle/DependencyInjection/EzPublishLegacyExtension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundle/DependencyInjection/EzPublishLegacyExtension.php b/bundle/DependencyInjection/EzPublishLegacyExtension.php index 6f5fd617..b24b37ac 100644 --- a/bundle/DependencyInjection/EzPublishLegacyExtension.php +++ b/bundle/DependencyInjection/EzPublishLegacyExtension.php @@ -59,7 +59,7 @@ public function load(array $configs, ContainerBuilder $container) $processor = new ConfigurationProcessor($container, 'ezpublish_legacy'); $processor->mapConfig( $config, - function (array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer) { + function (array $scopeSettings, $currentScope, ContextualizerInterface $contextualizer) { if (isset($scopeSettings['templating']['view_layout'])) { $contextualizer->setContextualParameter('view_default_layout', $currentScope, $scopeSettings['templating']['view_layout']); } From 5acfac207df53b279ec0d824535596eead998784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20R?= Date: Thu, 14 Apr 2016 17:28:55 +0200 Subject: [PATCH 3/8] [Tests] Send closure as expected to avoid TypeError on php7 --- mvc/Tests/KernelTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mvc/Tests/KernelTest.php b/mvc/Tests/KernelTest.php index 05e93ddc..f0adb5d4 100644 --- a/mvc/Tests/KernelTest.php +++ b/mvc/Tests/KernelTest.php @@ -33,7 +33,7 @@ public function testRunCallbackWithException() $iterations = 1; do { try { - $this->getLegacyKernel()->runCallback(''); + $this->getLegacyKernel()->runCallback(function () {}); } // this will occur on the 2nd iteration if the kernel state hasn't been correctly reset catch (RuntimeException $e) { From ab5ab092748c76e926b20b0c3b270e01248b49bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20R?= Date: Mon, 15 Aug 2016 12:05:59 +0200 Subject: [PATCH 4/8] [Composer] Bump dependencies to versions suitable for php7 --- .travis.yml | 4 +--- composer.json | 8 ++++---- composer_install_github_key.sh | 4 ---- 3 files changed, 5 insertions(+), 11 deletions(-) delete mode 100755 composer_install_github_key.sh diff --git a/.travis.yml b/.travis.yml index 86c3dca0..28721909 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,8 +15,6 @@ branches: # setup requirements for running unit tests before_script: - # Get latests version of composer which is faster (and to attempt to avoid memory issues with legacy package) - - travis_retry composer self-update # Disable xdebug to speed things up as we don't currently generate coverge on travis - if [ $TRAVIS_PHP_VERSION != "hhvm" ]; then phpenv config-rm xdebug.ini ; fi # Avoid issues on composer install since we pull in both legacy and platform stack @@ -29,7 +27,7 @@ before_script: - cp config.php-DEVELOPMENT config.php # execute phpunit as the script command -script: "./bin/phpunit -d date.timezone='America/New_York' -d memory_limit=-1" +script: "php -d date.timezone='America/New_York' -d memory_limit=-1 bin/phpunit" # disable mail notifications notifications: diff --git a/composer.json b/composer.json index b998ffaf..197152a4 100644 --- a/composer.json +++ b/composer.json @@ -15,10 +15,10 @@ "twig/twig": "^1.23 | ^2.0" }, "require-dev": { - "matthiasnoback/symfony-dependency-injection-test": "0.*", - "phpunit/phpunit": "~4.1.3", - "mikey179/vfsStream": "1.1.0", - "mockery/mockery": "dev-master" + "matthiasnoback/symfony-dependency-injection-test": "^1.0", + "phpunit/phpunit": "~4.7", + "mikey179/vfsStream": "~1.1.0", + "mockery/mockery": "^0.9" }, "autoload": { "psr-4": { diff --git a/composer_install_github_key.sh b/composer_install_github_key.sh deleted file mode 100755 index 3596176a..00000000 --- a/composer_install_github_key.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -mkdir -p ~/.composer -echo '{ "config": { "github-oauth": { "github.com": "cf20c86050d2c206b34d1fa8958dca40bfe08afd" } } }' > ~/.composer/config.json From 3a855c8f200ea0872fb0386f8e1ab20fccf5a023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20R?= Date: Mon, 15 Aug 2016 12:11:35 +0200 Subject: [PATCH 5/8] [HttpCache] Adapt SwitchableHttpCachePurger for EZP-25003 --- bundle/Cache/SwitchableHttpCachePurger.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bundle/Cache/SwitchableHttpCachePurger.php b/bundle/Cache/SwitchableHttpCachePurger.php index 79844750..dd67c90f 100644 --- a/bundle/Cache/SwitchableHttpCachePurger.php +++ b/bundle/Cache/SwitchableHttpCachePurger.php @@ -24,13 +24,13 @@ public function __construct(GatewayCachePurger $gatewayCachePurger) $this->gatewayCachePurger = $gatewayCachePurger; } - public function purge($cacheElements) + public function purge($locationIds) { if ($this->isSwitchedOff()) { - return $cacheElements; + return $locationIds; } - return $this->gatewayCachePurger->purge($cacheElements); + return $this->gatewayCachePurger->purge($locationIds); } public function purgeAll() @@ -42,12 +42,12 @@ public function purgeAll() $this->gatewayCachePurger->purgeAll(); } - public function purgeForContent($contentId) + public function purgeForContent($contentId, $locationIds = array()) { if ($this->isSwitchedOff()) { return; } - $this->gatewayCachePurger->purgeForContent($contentId); + $this->gatewayCachePurger->purgeForContent($contentId, $locationIds); } } From da8e9506b4559640d7168c76956efe39b2bb49ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20R?= Date: Mon, 15 Aug 2016 13:17:04 +0200 Subject: [PATCH 6/8] [Tests] Silence deprecation errors from legacy in regards to constructor names as it will most likely never be changed --- bundle/Tests/SiteAccess/LegacyMapperTest.php | 16 ++++++++++++++++ mvc/Tests/Security/SSOListenerTest.php | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/bundle/Tests/SiteAccess/LegacyMapperTest.php b/bundle/Tests/SiteAccess/LegacyMapperTest.php index dbdb7e30..e6fc6c61 100644 --- a/bundle/Tests/SiteAccess/LegacyMapperTest.php +++ b/bundle/Tests/SiteAccess/LegacyMapperTest.php @@ -15,6 +15,22 @@ class LegacyMapperTest extends LegacyBasedTestCase { + private $systemErrorLevel; + + protected function setUp() + { + parent::setUp(); + + // Silence E_DEPRECATED to avoid issues with notices from legacy in regards to constructors + $this->systemErrorLevel = error_reporting(E_ALL & ~E_DEPRECATED); + } + + protected function tearDown() + { + error_reporting($this->systemErrorLevel); + parent::tearDown(); + } + /** * @dataProvider siteAccessMatchProvider */ diff --git a/mvc/Tests/Security/SSOListenerTest.php b/mvc/Tests/Security/SSOListenerTest.php index 9759cbff..d2c9a73d 100644 --- a/mvc/Tests/Security/SSOListenerTest.php +++ b/mvc/Tests/Security/SSOListenerTest.php @@ -83,7 +83,8 @@ public function testGetPreAuthenticatedData() $userId = 123; $passwordHash = md5('password'); - $legacyUser = new eZUser(array('contentobject_id' => $userId)); + // Specifically silence E_DEPRECATED on constructor name for php7 + $legacyUser = @new eZUser(array('contentobject_id' => $userId)); $apiUser = $this ->getMockBuilder('eZ\Publish\API\Repository\Values\User\User') ->setConstructorArgs(array(array('passwordHash' => $passwordHash))) From 2dab64870d3ee65e3b543f985297bb8a593d9779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20R?= Date: Wed, 17 Aug 2016 15:17:45 +0200 Subject: [PATCH 7/8] [Travis] Enable caching of Composer packages --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 28721909..d83a1192 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,10 @@ php: - 5.6 - 7.0 +cache: + directories: + - $HOME/.composer/cache/files + # test only master (+ Pull requests) branches: only: From b6b85e838ed1569acc9b26b07b4c4fd8a462b208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20R?= Date: Thu, 18 Aug 2016 13:51:22 +0200 Subject: [PATCH 8/8] [Composer] Require SensioDistributionBundle 3|4 as we use Configurator to dump config here --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 197152a4..cb589073 100644 --- a/composer.json +++ b/composer.json @@ -12,6 +12,7 @@ "require": { "ezsystems/ezpublish-legacy": ">=2014.11", "ezsystems/ezpublish-kernel": "~6.0@dev", + "sensio/distribution-bundle": "^3.0|^4.0", "twig/twig": "^1.23 | ^2.0" }, "require-dev": {