diff --git a/.travis.yml b/.travis.yml index c16a93b03f..00e468ffdd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,17 +11,22 @@ php: env: TMPDIR=/tmp install: - - sh ./tests/install_dependencies.sh + - if [[ "$TRAVIS_PHP_VERSION" == "5.2" ]]; then sh ./tests/php52_install_dependencies.sh; fi - phpenv rehash services: - memcached before_script: + - if [[ "$TRAVIS_PHP_VERSION" != "5.2" ]]; then travis_retry composer self-update; fi + - if [[ "$TRAVIS_PHP_VERSION" != "5.2" ]]; then travis_retry composer install --no-interaction --prefer-source --dev; fi + - mysql -e 'create database zftest;' - psql -c 'create database zftest;' -U postgres - - echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + + - if [[ "$TRAVIS_PHP_VERSION" != "5.2" ]]; then phpenv config-add tests/config.ini; fi + - if [[ "$TRAVIS_PHP_VERSION" == "5.2" ]]; then phpenv config-add tests/php52_config.ini; fi + - cp ./tests/TestConfiguration.travis.php ./tests/TestConfiguration.php script: diff --git a/tests/Zend/Cache/LibmemcachedBackendTest.php b/tests/Zend/Cache/LibmemcachedBackendTest.php index 43f87fb259..59f2db7578 100644 --- a/tests/Zend/Cache/LibmemcachedBackendTest.php +++ b/tests/Zend/Cache/LibmemcachedBackendTest.php @@ -50,6 +50,11 @@ public function __construct($name = null, array $data = array(), $dataName = '') public function setUp($notag = true) { + if(!class_exists('Memcached')) { + $this->markTestSkipped('Memcached is not installed, skipping test'); + return; + } + $serverValid = array( 'host' => TESTS_ZEND_CACHE_LIBMEMCACHED_HOST, 'port' => TESTS_ZEND_CACHE_LIBMEMCACHED_PORT, diff --git a/tests/Zend/Cache/MemcachedBackendTest.php b/tests/Zend/Cache/MemcachedBackendTest.php index c8058fad8e..233b8f33e9 100644 --- a/tests/Zend/Cache/MemcachedBackendTest.php +++ b/tests/Zend/Cache/MemcachedBackendTest.php @@ -50,6 +50,11 @@ public function __construct($name = null, array $data = array(), $dataName = '') public function setUp($notag = true) { + if(!class_exists('Memcached')) { + $this->markTestSkipped('Memcached is not installed, skipping test'); + return; + } + $serverValid = array( 'host' => TESTS_ZEND_CACHE_MEMCACHED_HOST, 'port' => TESTS_ZEND_CACHE_MEMCACHED_PORT, diff --git a/tests/config.ini b/tests/config.ini new file mode 100644 index 0000000000..24079f5c1c --- /dev/null +++ b/tests/config.ini @@ -0,0 +1,2 @@ +extension = memcache.so +extension = memcached.so \ No newline at end of file diff --git a/tests/install_dependencies.sh b/tests/install_dependencies.sh deleted file mode 100644 index 5aadb1c8c0..0000000000 --- a/tests/install_dependencies.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -echo $TRAVIS_PHP_VERSION; - -if [ "$TRAVIS_PHP_VERSION" = "5.2" ]; then - # To install DbUnit, we have to install everything - pear channel-discover pear.phpunit.de - pear channel-discover pear.symfony-project.com - pear update-channels - - # remove any existing phpunit packages - pear uninstall -n pear.phpunit.de/PHPUnit - pear uninstall -n pear.phpunit.de/PHP_CodeCoverage - pear uninstall -n pear.phpunit.de/PHPUnit_MockObject - pear uninstall -n pear.phpunit.de/File_Iterator - pear uninstall -n pear.phpunit.de/Text_Template - pear uninstall -n pear.phpunit.de/PHP_Timer - pear uninstall -n pear.symfony-project.com/YAML - - # Install - pear install -o pear.phpunit.de/PHPUnit - pear install pear.phpunit.de/DbUnit -else - composer install --no-interaction --prefer-source --dev -fi - - diff --git a/tests/php52_config.ini b/tests/php52_config.ini new file mode 100644 index 0000000000..3a9163e6da --- /dev/null +++ b/tests/php52_config.ini @@ -0,0 +1 @@ +extension = memcached.so \ No newline at end of file diff --git a/tests/php52_install_dependencies.sh b/tests/php52_install_dependencies.sh new file mode 100644 index 0000000000..fa39106eb6 --- /dev/null +++ b/tests/php52_install_dependencies.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +# To install DbUnit, we have to install everything +pear channel-discover pear.phpunit.de +pear channel-discover pear.symfony-project.com +pear update-channels + +# remove any existing phpunit packages +pear uninstall -n pear.phpunit.de/PHPUnit +pear uninstall -n pear.phpunit.de/PHP_CodeCoverage +pear uninstall -n pear.phpunit.de/PHPUnit_MockObject +pear uninstall -n pear.phpunit.de/File_Iterator +pear uninstall -n pear.phpunit.de/Text_Template +pear uninstall -n pear.phpunit.de/PHP_Timer +pear uninstall -n pear.symfony-project.com/YAML + +# memcache 2.1.0 is the last version to support the php 5.2 branch +pecl download memcached-2.1.0 +tar zxvf memcached*.tgz && cd memcached* +make clean +printf "\n" | phpize +./configure --with-libmemcached-dir=/usr/local && make && make install + +printf "\n" | pecl uninstall memcache +printf "\n" | pecl install memcache + +# Install +pear install -o pear.phpunit.de/PHPUnit +pear install pear.phpunit.de/DbUnit + +