From 2ac5c86e3771529daa72ab96ec3be4848749255f Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 23 Oct 2014 11:18:00 +0200 Subject: [PATCH] enforce memcached version to be 2.1.0 The signature of the `Memcached::get()` method changed with 2.2.0. Therefore, tests fail in Symfony when mocking `Memcached` in the `MemcachedSessionHandlerTest` of the HttpFoundation component (see also php-memcached-dev/php-memcached#126 and https://bugs.php.net/bug.php?id=66331). --- .travis.yml | 2 +- .../Session/Storage/Handler/MemcachedSessionHandlerTest.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cc764bea0d..9860cd03a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,7 @@ before_install: - sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then echo "" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini; fi;' - sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;' - sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ] && [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;' - - sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;' + - sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then pecl install -f memcached-2.1.0; fi;' - sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm-nightly" ]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;' - sudo locale-gen fr_FR.UTF-8 && sudo update-locale # - sh -c 'if [ "$TRAVIS_PHP_VERSION" != "5.3.3" ]; then phpunit --self-update; fi;' diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php index 985fae4888..036760cb70 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php @@ -31,6 +31,10 @@ class MemcachedSessionHandlerTest extends \PHPUnit_Framework_TestCase $this->markTestSkipped('Skipped tests Memcached class is not present'); } + if (version_compare(phpversion('memcached'), '2.2.0', '>=')) { + $this->markTestSkipped('Tests can only be run with memcached extension 2.1.0 or lower'); + } + $this->memcached = $this->getMock('Memcached'); $this->storage = new MemcachedSessionHandler( $this->memcached,