Переглянути джерело

fix travis ci build for php 5.2

Adar Porat 11 роки тому
батько
коміт
41619e3dfb

+ 8 - 3
.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:

+ 5 - 0
tests/Zend/Cache/LibmemcachedBackendTest.php

@@ -50,6 +50,11 @@ class Zend_Cache_LibmemcachedBackendTest extends Zend_Cache_CommonExtendedBacken
 
     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,

+ 5 - 0
tests/Zend/Cache/MemcachedBackendTest.php

@@ -50,6 +50,11 @@ class Zend_Cache_MemcachedBackendTest extends Zend_Cache_CommonExtendedBackendTe
 
     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,

+ 2 - 0
tests/config.ini

@@ -0,0 +1,2 @@
+extension = memcache.so
+extension = memcached.so

+ 0 - 27
tests/install_dependencies.sh

@@ -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
-
-

+ 1 - 0
tests/php52_config.ini

@@ -0,0 +1 @@
+extension = memcached.so

+ 31 - 0
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
+
+