Skip to content

Commit 76445a3

Browse files
committed
Update server used in PHP 5.4, 5.5, and 5.6 tests.
This change updates the server used for PHP 5.4, 5.5, and 5.6 tests in order to support SEARCH requests. Using the PHP built-in web server in these versions errors with 501 Not Implemented / Request method not supported.
1 parent 130b7a3 commit 76445a3

File tree

4 files changed

+66
-8
lines changed

4 files changed

+66
-8
lines changed

tests/before_script.sh

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
1+
install_nginx() {
2+
$superuser apt-get install -y nginx
3+
}
4+
5+
use_php_fpm() {
6+
root="$(pwd)/tests/PHPCurlClass"
7+
$superuser tee /etc/nginx/sites-enabled/default <<EOF
8+
server {
9+
listen 8000 default_server;
10+
root ${root};
11+
index index.php;
12+
server_name localhost;
13+
location / {
14+
rewrite ^ /index.php last;
15+
}
16+
location ~ \.php$ {
17+
fastcgi_split_path_info ^(.+\.php)(/.+)$;
18+
fastcgi_pass 127.0.0.1:9000;
19+
fastcgi_index index.php;
20+
include fastcgi_params;
21+
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
22+
fastcgi_param "PHP_CURL_CLASS_TEST_MODE_ENABLED" "yes";
23+
}
24+
}
25+
EOF
26+
$superuser php-fpm --daemonize
27+
}
28+
29+
reload_nginx() {
30+
$superuser /etc/init.d/nginx restart
31+
}
32+
133
phpunit_shim() {
234
# -class CurlTest extends \PHPUnit\Framework\TestCase
335
# +class CurlTest extends \PHPUnit_Framework_TestCase
@@ -50,7 +82,7 @@ if [[ "${TRAVIS_PHP_VERSION}" == "5.3" ]]; then
5082
fi
5183
$superuser add-apt-repository -y ppa:nginx/development
5284
$superuser apt-get update
53-
$superuser apt-get install -y nginx
85+
install_nginx
5486
$superuser apt-get install -y php5-fpm
5587
root="$(pwd)/tests/PHPCurlClass"
5688
$superuser tee /etc/nginx/sites-enabled/default <<EOF
@@ -73,16 +105,22 @@ server {
73105
}
74106
EOF
75107
$superuser /etc/init.d/php5-fpm start
76-
$superuser /etc/init.d/nginx restart
108+
reload_nginx
77109
phpunit_shim
78110
elif [[ "${TRAVIS_PHP_VERSION}" == "5.4" ]]; then
79-
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &
111+
install_nginx
112+
use_php_fpm
113+
reload_nginx
80114
phpunit_shim
81115
elif [[ "${TRAVIS_PHP_VERSION}" == "5.5" ]]; then
82-
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &
116+
install_nginx
117+
use_php_fpm
118+
reload_nginx
83119
phpunit_shim
84120
elif [[ "${TRAVIS_PHP_VERSION}" == "5.6" ]]; then
85-
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &
121+
install_nginx
122+
use_php_fpm
123+
reload_nginx
86124
phpunit_shim
87125
elif [[ "${TRAVIS_PHP_VERSION}" == "7.0" ]]; then
88126
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &

tests/dockerfiles/php54/Dockerfile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
1-
FROM php:5.4-cli
1+
FROM php:5.4-fpm
22
ENV DEBIAN_FRONTEND noninteractive
33

4+
# Fix error:
5+
# "W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/InRelease Unable to find expected
6+
# entry 'main/binary-amd64/Packages' in Release file (Wrong sources.list entry or malformed file)
7+
# E: Some index files failed to download. They have been ignored, or old ones used instead."
8+
RUN printf "%s\n" \
9+
"deb http://archive.debian.org/debian/ jessie main" \
10+
"deb-src http://archive.debian.org/debian/ jessie main" \
11+
"deb http://security.debian.org jessie/updates main" \
12+
"deb-src http://security.debian.org jessie/updates main" \
13+
> /etc/apt/sources.list
14+
415
RUN apt-get --assume-yes --quiet update
516

617
RUN apt-get --assume-yes --quiet install git && \

tests/dockerfiles/php55/Dockerfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1-
FROM php:5.5-cli
1+
FROM php:5.5-fpm
22
ENV DEBIAN_FRONTEND noninteractive
33

4+
# Fix error:
5+
# "E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?".
6+
RUN printf "%s\n" \
7+
"deb http://archive.debian.org/debian/ jessie main" \
8+
"deb-src http://archive.debian.org/debian/ jessie main" \
9+
"deb http://security.debian.org jessie/updates main" \
10+
"deb-src http://security.debian.org jessie/updates main" \
11+
> /etc/apt/sources.list
12+
413
RUN apt-get --assume-yes --quiet update
514

615
RUN apt-get --assume-yes --quiet install git && \

tests/dockerfiles/php56/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:5.6-cli
1+
FROM php:5.6-fpm
22
ENV DEBIAN_FRONTEND noninteractive
33

44
RUN apt-get --assume-yes --quiet update

0 commit comments

Comments
 (0)