Skip to content

Commit 745b1c6

Browse files
committed
Merge pull request php-curl-class#71 from zborboa-google/master
Fix php-curl-class#45: Replace HHVM's built-in webserver with Nginx for continuous integration tests
2 parents ccd05cb + 462839d commit 745b1c6

File tree

4 files changed

+29
-13
lines changed

4 files changed

+29
-13
lines changed

.travis.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
language: php
2+
23
php:
34
- 5.3
45
- 5.4
56
- 5.5
67
- 5.6
78
- hhvm
9+
810
matrix:
911
allow_failures:
1012
- php: 5.6
1113
- php: hhvm
14+
1215
before_script:
13-
- if [[ "$TRAVIS_PHP_VERSION" == "5.4" ]]; then sh -c "php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &"; fi
14-
- if [[ "$TRAVIS_PHP_VERSION" == "5.5" ]]; then sh -c "php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &"; fi
15-
- if [[ "$TRAVIS_PHP_VERSION" == "5.6" ]]; then sh -c "php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &"; fi
16-
- if [[ "$TRAVIS_PHP_VERSION" == "hhvm" ]]; then sh -c "cd tests && hhvm --mode server --port 8000 --config PHPCurlClass/server.hdf &"; fi
16+
- bash tests/before_script.sh
17+
1718
script:
18-
- find . -type "f" -iname "*.php" | xargs -L "1" php -l
19-
- if [[ "$TRAVIS_PHP_VERSION" != "5.3" ]]; then sh -c "cd tests && phpunit --configuration phpunit.xml"; fi
19+
- bash tests/script.sh

tests/PHPCurlClass/server.hdf

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

tests/before_script.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
if [[ "${TRAVIS_PHP_VERSION}" == "5.4" ]]; then
2+
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &
3+
elif [[ "${TRAVIS_PHP_VERSION}" == "5.5" ]]; then
4+
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &
5+
elif [[ "${TRAVIS_PHP_VERSION}" == "5.6" ]]; then
6+
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &
7+
elif [[ "${TRAVIS_PHP_VERSION}" == "hhvm" ]]; then
8+
sudo add-apt-repository -y ppa:nginx/stable
9+
sudo apt-get update
10+
sudo apt-get install -y nginx
11+
sudo /usr/share/hhvm/install_fastcgi.sh
12+
root="$(pwd)/tests/PHPCurlClass"
13+
root="${root//\//\\/}"
14+
sudo sed --in-place --regexp-extended 's/listen 80 default_server;/listen 8000 default_server;/' /etc/nginx/sites-enabled/default
15+
sudo sed --in-place --regexp-extended "s/root \/usr\/share\/nginx\/html;/root ${root};/" /etc/nginx/sites-enabled/default
16+
sudo sed --in-place --regexp-extended 's/index index.html index.htm;/index index.php;/' /etc/nginx/sites-enabled/default
17+
sudo /etc/init.d/nginx restart
18+
fi

tests/script.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
find . -type "f" -iname "*.php" | xargs -L "1" php -l
2+
3+
if [[ "${TRAVIS_PHP_VERSION}" != "5.3" ]]; then
4+
cd tests && phpunit --configuration phpunit.xml
5+
fi

0 commit comments

Comments
 (0)