Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 94be5f4

Browse files
committed
Merge pull request zendframework#448 from aporat/travis_php52_fix
Fix Travis CI build for PHP 5.2
2 parents 4a9d203 + 41619e3 commit 94be5f4

File tree

7 files changed

+52
-30
lines changed

7 files changed

+52
-30
lines changed

.travis.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,22 @@ php:
1111
env: TMPDIR=/tmp
1212

1313
install:
14-
- sh ./tests/install_dependencies.sh
14+
- if [[ "$TRAVIS_PHP_VERSION" == "5.2" ]]; then sh ./tests/php52_install_dependencies.sh; fi
1515
- phpenv rehash
1616

1717
services:
1818
- memcached
1919

2020
before_script:
21+
- if [[ "$TRAVIS_PHP_VERSION" != "5.2" ]]; then travis_retry composer self-update; fi
22+
- if [[ "$TRAVIS_PHP_VERSION" != "5.2" ]]; then travis_retry composer install --no-interaction --prefer-source --dev; fi
23+
2124
- mysql -e 'create database zftest;'
2225
- psql -c 'create database zftest;' -U postgres
23-
- echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
24-
- echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
26+
27+
- if [[ "$TRAVIS_PHP_VERSION" != "5.2" ]]; then phpenv config-add tests/config.ini; fi
28+
- if [[ "$TRAVIS_PHP_VERSION" == "5.2" ]]; then phpenv config-add tests/php52_config.ini; fi
29+
2530
- cp ./tests/TestConfiguration.travis.php ./tests/TestConfiguration.php
2631

2732
script:

tests/Zend/Cache/LibmemcachedBackendTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ public function __construct($name = null, array $data = array(), $dataName = '')
5050

5151
public function setUp($notag = true)
5252
{
53+
if(!class_exists('Memcached')) {
54+
$this->markTestSkipped('Memcached is not installed, skipping test');
55+
return;
56+
}
57+
5358
$serverValid = array(
5459
'host' => TESTS_ZEND_CACHE_LIBMEMCACHED_HOST,
5560
'port' => TESTS_ZEND_CACHE_LIBMEMCACHED_PORT,

tests/Zend/Cache/MemcachedBackendTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ public function __construct($name = null, array $data = array(), $dataName = '')
5050

5151
public function setUp($notag = true)
5252
{
53+
if(!class_exists('Memcached')) {
54+
$this->markTestSkipped('Memcached is not installed, skipping test');
55+
return;
56+
}
57+
5358
$serverValid = array(
5459
'host' => TESTS_ZEND_CACHE_MEMCACHED_HOST,
5560
'port' => TESTS_ZEND_CACHE_MEMCACHED_PORT,

tests/config.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
extension = memcache.so
2+
extension = memcached.so

tests/install_dependencies.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.

tests/php52_config.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extension = memcached.so

tests/php52_install_dependencies.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
3+
# To install DbUnit, we have to install everything
4+
pear channel-discover pear.phpunit.de
5+
pear channel-discover pear.symfony-project.com
6+
pear update-channels
7+
8+
# remove any existing phpunit packages
9+
pear uninstall -n pear.phpunit.de/PHPUnit
10+
pear uninstall -n pear.phpunit.de/PHP_CodeCoverage
11+
pear uninstall -n pear.phpunit.de/PHPUnit_MockObject
12+
pear uninstall -n pear.phpunit.de/File_Iterator
13+
pear uninstall -n pear.phpunit.de/Text_Template
14+
pear uninstall -n pear.phpunit.de/PHP_Timer
15+
pear uninstall -n pear.symfony-project.com/YAML
16+
17+
# memcache 2.1.0 is the last version to support the php 5.2 branch
18+
pecl download memcached-2.1.0
19+
tar zxvf memcached*.tgz && cd memcached*
20+
make clean
21+
printf "\n" | phpize
22+
./configure --with-libmemcached-dir=/usr/local && make && make install
23+
24+
printf "\n" | pecl uninstall memcache
25+
printf "\n" | pecl install memcache
26+
27+
# Install
28+
pear install -o pear.phpunit.de/PHPUnit
29+
pear install pear.phpunit.de/DbUnit
30+
31+

0 commit comments

Comments
 (0)