Remove PHP v5.x support and add basic doc for how one may install the old version

This commit is contained in:
Zach Borboa
2021-03-17 12:19:38 -04:00
parent 8746d9a5d1
commit cc3f7bac24
40 changed files with 19 additions and 670 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ For latest commit version:
### Requirements
PHP Curl Class works with PHP 5.3, 5.4, 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, and 8.0.
PHP Curl Class works with PHP 7.0, 7.1, 7.2, 7.3, 7.4, and 8.0.
### Quick Start and Examples
+1 -1
View File
@@ -14,7 +14,7 @@
}
],
"require": {
"php": ">=5.3",
"php": ">=7.0",
"ext-curl": "*"
},
"require-dev": {
+9
View File
@@ -0,0 +1,9 @@
# PHP Curl Class v5.x
PHP Curl Class previously supported 5.3, 5.4, 5.5, and 5.6.
### Installation
To install PHP Curl Class for PHP 5.x versions:
$ composer require php-curl-class/php-curl-class:dev-php5.x-master
-20
View File
@@ -710,19 +710,9 @@ class Curl
$this->setOpt(CURLOPT_CUSTOMREQUEST, 'POST');
} else {
if (isset($this->options[CURLOPT_CUSTOMREQUEST])) {
if ((version_compare(PHP_VERSION, '5.5.11') < 0)) {
trigger_error(
'Due to technical limitations of PHP <= 5.5.11, it is not possible to '
. 'perform a post-redirect-get request using a php-curl-class Curl object that '
. 'has already been used to perform other types of requests. Either use a new '
. 'php-curl-class Curl object or upgrade your PHP engine.',
E_USER_ERROR
);
} else {
$this->setOpt(CURLOPT_CUSTOMREQUEST, null);
}
}
}
$this->setOpt(CURLOPT_POST, true);
$this->setOpt(CURLOPT_POSTFIELDS, $this->buildPostData($data));
@@ -874,20 +864,10 @@ class Curl
*/
public function setMaxFilesize($bytes)
{
// Make compatible with PHP version both before and after 5.5.0. PHP 5.5.0 added the cURL resource as the first
// argument to the CURLOPT_PROGRESSFUNCTION callback.
$gte_v550 = version_compare(PHP_VERSION, '5.5.0') >= 0;
if ($gte_v550) {
$callback = function ($resource, $download_size, $downloaded, $upload_size, $uploaded) use ($bytes) {
// Abort the transfer when $downloaded bytes exceeds maximum $bytes by returning a non-zero value.
return $downloaded > $bytes ? 1 : 0;
};
} else {
$callback = function ($download_size, $downloaded, $upload_size, $uploaded) use ($bytes) {
return $downloaded > $bytes ? 1 : 0;
};
}
$this->progress($callback);
}
-8
View File
@@ -16,14 +16,6 @@ class Decoder
public static function decodeJson()
{
$args = func_get_args();
// Call json_decode() without the $options parameter in PHP
// versions less than 5.4.0 as the $options parameter was added in
// PHP version 5.4.0.
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
$args = array_slice($args, 0, 3);
}
$response = call_user_func_array('json_decode', $args);
if ($response === null) {
$response = $args['0'];
-8
View File
@@ -20,14 +20,6 @@ class Encoder
public static function encodeJson()
{
$args = func_get_args();
// Call json_encode() without the $depth parameter in PHP
// versions less than 5.5.0 as the $depth parameter was added in
// PHP version 5.5.0.
if (version_compare(PHP_VERSION, '5.5.0', '<')) {
$args = array_slice($args, 0, 2);
}
$value = call_user_func_array('json_encode', $args);
if (json_last_error() !== JSON_ERROR_NONE) {
if (function_exists('json_last_error_msg')) {
+1 -41
View File
@@ -497,36 +497,9 @@ class CurlTest extends \PHPUnit\Framework\TestCase
$test->curl->setOpt(CURLOPT_FOLLOWLOCATION, true);
$this->assertEquals('Redirected: POST', $test->server('post_redirect_get', 'POST', array(), true));
// On compatible PHP engines, ensure that it is possible to reuse an existing Curl object
if (version_compare(PHP_VERSION, '5.5.11') > 0) {
// Ensure that it is possible to reuse an existing Curl object.
$this->assertEquals('Redirected: GET', $test->server('post_redirect_get', 'POST'));
}
}
public function testPostRedirectGetReuseObjectIncompatibleEngine()
{
if (version_compare(PHP_VERSION, '5.5.11') > 0) {
$this->markTestSkipped();
}
try {
// Follow 303 redirection with POST
$test = new Test();
$test->curl->setOpt(CURLOPT_FOLLOWLOCATION, true);
$test->server('post_redirect_get', 'POST', array(), true);
// On incompatible PHP engines, reusing an existing Curl object to perform a
// post-redirect-get request will trigger a PHP error
$test->server('post_redirect_get', 'POST');
$this->assertTrue(
false,
'Reusing an existing Curl object on incompatible PHP engines shall trigger an error.'
);
} catch (\PHPUnit_Framework_Error $e) {
$this->assertTrue(true);
}
}
public function testPutRequestMethod()
{
@@ -3301,11 +3274,6 @@ class CurlTest extends \PHPUnit\Framework\TestCase
public function testOptionSet()
{
// Skip this test on 5.3 and 5.4.
if (version_compare(PHP_VERSION, '5.5.0', '<')) {
$this->markTestSkipped();
}
// Skip this test on 8.0 and later:
// "ValueError: curl_setopt(): cURL option must not contain any null bytes"
if (version_compare(PHP_VERSION, '8.0.0', '>=')) {
@@ -3525,14 +3493,6 @@ class CurlTest extends \PHPUnit\Framework\TestCase
'request_header',
);
// Not all keys are included on PHP 5.3 (tested 5.3.29).
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
foreach (array('primary_ip', 'primary_port', 'local_ip', 'local_port') as $value) {
$key = array_search($value, $expected_keys);
unset($expected_keys[$key]);
}
}
foreach ($expected_keys as $key) {
$this->assertArrayHasKey($key, $info);
}
+1 -128
View File
@@ -1,64 +1,3 @@
install_nginx() {
$superuser apt-get install -y nginx
}
use_php_fpm() {
root="$(pwd)/tests/PHPCurlClass"
$superuser tee /etc/nginx/sites-enabled/default <<EOF
server {
listen 8000 default_server;
root ${root};
index index.php;
server_name localhost;
location / {
rewrite ^ /index.php last;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
fastcgi_param "PHP_CURL_CLASS_TEST_MODE_ENABLED" "yes";
}
}
EOF
$superuser php-fpm --daemonize
}
reload_nginx() {
$superuser /etc/init.d/nginx restart
}
php_v5_3_shim() {
remove_double_colon_class_name_resolution
}
phpunit_shim() {
# -class CurlTest extends \PHPUnit\Framework\TestCase
# +class CurlTest extends \PHPUnit_Framework_TestCase
find='class CurlTest extends \\PHPUnit\\Framework\\TestCase'
replace='class CurlTest extends \\PHPUnit_Framework_TestCase'
sed -i'' -e"s/${find}/${replace}/" "$(pwd)/tests/PHPCurlClass/PHP"*
# -\PHPUnit\Framework\Assert
# +\PHPUnit_Framework_Assert
find='\\PHPUnit\\Framework\\Assert'
replace='\\PHPUnit_Framework_Assert'
sed -i'' -e"s/${find}/${replace}/" "$(pwd)/tests/PHPCurlClass/PHP"*
sed -i'' -e"s/${find}/${replace}/" "$(pwd)/tests/PHPCurlClass/Helper.php"
# -\PHPUnit\Framework\Error\Warning
# +\PHPUnit_Framework_Error_Warning
find='\\PHPUnit\\Framework\\Error\\Warning'
replace='\\PHPUnit_Framework_Error_Warning'
sed -i'' -e"s/${find}/${replace}/" "$(pwd)/tests/PHPCurlClass/PHP"*
}
remove_double_colon_class_name_resolution() {
sed -i'' -e"/::class/d" "$(pwd)/tests/PHPCurlClass/PHP"*
}
remove_expectWarning() {
# Fix "Call to undefined method CurlTest\CurlTest::expectWarning()".
sed -i'' -e"/->expectWarning(/d" "$(pwd)/tests/PHPCurlClass/PHP"*
@@ -72,10 +11,6 @@ replace_assertStringContainsString() {
sed -i'' -e"s/${find}/${replace}/" "$(pwd)/tests/PHPCurlClass/PHP"*
}
phpunit_v4_8_shim() {
replace_assertStringContainsString
}
phpunit_v6_5_shim() {
remove_expectWarning
replace_assertStringContainsString
@@ -101,72 +36,10 @@ php -r "var_dump(curl_version());"
composer self-update
composer install --prefer-source --no-interaction
# Use docker-specific settings.
if [ -f "/.dockerenv" ]; then
# Skip using sudo.
superuser=""
# Use unix socket.
fastcgi_pass="unix:/var/run/php5-fpm.sock"
else
# Use sudo.
superuser="sudo"
# Use ip socket.
fastcgi_pass="127.0.0.1:9000"
fi
# Let test server know we should allow testing.
export PHP_CURL_CLASS_TEST_MODE_ENABLED="yes"
if [[ "${CI_PHP_VERSION}" == "5.3" ]]; then
if ! [ -x "$(command -v add-apt-repository)" ]; then
$superuser apt-get install -y python-software-properties
$superuser apt-get install -y software-properties-common
fi
$superuser add-apt-repository -y ppa:nginx/development
$superuser apt-get update
install_nginx
$superuser apt-get install -y php5-fpm
root="$(pwd)/tests/PHPCurlClass"
$superuser tee /etc/nginx/sites-enabled/default <<EOF
server {
listen 8000 default_server;
root ${root};
index index.php;
server_name localhost;
location / {
rewrite ^ /index.php last;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass ${fastcgi_pass};
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
fastcgi_param "PHP_CURL_CLASS_TEST_MODE_ENABLED" "yes";
}
}
EOF
$superuser /etc/init.d/php5-fpm start
reload_nginx
phpunit_shim
phpunit_v4_8_shim
php_v5_3_shim
elif [[ "${CI_PHP_VERSION}" == "5.4" ]]; then
install_nginx
use_php_fpm
reload_nginx
phpunit_shim
elif [[ "${CI_PHP_VERSION}" == "5.5" ]]; then
install_nginx
use_php_fpm
reload_nginx
phpunit_shim
elif [[ "${CI_PHP_VERSION}" == "5.6" ]]; then
install_nginx
use_php_fpm
reload_nginx
phpunit_shim
elif [[ "${CI_PHP_VERSION}" == "7.0" ]]; then
if [[ "${CI_PHP_VERSION}" == "7.0" ]]; then
phpunit_v6_5_shim
start_php_servers
elif [[ "${CI_PHP_VERSION}" == "7.1" ]]; then
-3
View File
@@ -1,3 +0,0 @@
# Build an image.
set -x
docker build --tag="php-curl-class/php53" .
-15
View File
@@ -1,15 +0,0 @@
# Run image to create container.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
set -x
cd "${SCRIPT_DIR}/../../.."
project_dir="${PWD}"
docker start "php53" ||
docker run \
--detach \
--interactive \
--mount "type=bind,src=${project_dir},dst=/data,readonly=true" \
--name="php53" \
--tty \
"php-curl-class/php53"
-18
View File
@@ -1,18 +0,0 @@
# Run tests inside container.
command=$(cat <<-END
mkdir --parents "/tmp/php-curl-class" &&
rsync --delete --exclude=".git" --exclude="vendor" --exclude="composer.lock" --links --recursive "/data/" "/tmp/php-curl-class/" &&
cd "/tmp/php-curl-class" &&
export CI_PHP_VERSION="5.3" &&
(
[ ! -f "/tmp/.composer_updated" ] &&
composer --no-interaction update &&
touch "/tmp/.composer_updated" ||
exit 0
) &&
bash "tests/before_script.sh" &&
bash "tests/script.sh"
END
)
set -x
docker exec --tty "php53" sh -c "${command}"
-3
View File
@@ -1,3 +0,0 @@
# Stop container.
set -x
docker stop "php53"
-66
View File
@@ -1,66 +0,0 @@
FROM debian:jessie
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get --assume-yes --quiet update
RUN apt-get --assume-yes --quiet install \
curl \
rsync \
# "/bin/sh: 1: make: not found"
make \
# "make[1]: *** No rule to make target '../include/openssl/bio.h', needed by 'cryptlib.o'. Stop."
# "configure: error: xml2-config not found. Please check your libxml2 installation."
libxml2-dev \
# "make[1]: gcc: Command not found"
gcc \
# tar (child): xz: Cannot exec: No such file or directory
# tar (child): Error is not recoverable: exiting now
# tar: Child returned status 2
# tar: Error is not recoverable: exiting now
xz-utils \
# "configure: error: Cannot find libz"
libssl-dev \
# "configure: error: Please reinstall the libcurl distribution -
# easy.h should be in <curl-dir>/include/curl/"
libcurl4-openssl-dev \
# "configure: error: png.h not found."
libpng-dev \
# "sh: 1: git: not found" (composer).
git \
# "Failed to download phpunit/phpunit from dist: The zip extension and unzip command are both missing,
# skipping."
zip
# Compile openssl so that php configure --with-openssl works.
RUN mkdir --parents "/tmp/openssl/" && \
curl --silent --show-error --output "openssl.tar.gz" \
"https://www.openssl.org/source/openssl-1.0.2k.tar.gz" && \
tar --extract --file "openssl.tar.gz" --directory "/tmp/openssl/" --strip-components="1" && \
cd "/tmp/openssl/" && \
./config && \
make && \
make install && \
rm -rf "/tmp/openssl/"
RUN mkdir --parents "/usr/src/php/" && \
curl --silent --show-error --output "php.tar.xz" \
"https://www.php.net/distributions/php-5.3.29.tar.xz" && \
tar --extract --file "php.tar.xz" --directory "/usr/src/php/" --strip-components="1" && \
rm "php.tar.xz"* && \
cd "/usr/src/php/" && \
./configure \
--enable-mbstring \
--with-curl \
--with-gd \
--with-openssl="/usr/local/ssl" \
--with-zlib && \
make --jobs="$(nproc)" && \
make install && \
make clean
RUN curl --silent --show-error "https://getcomposer.org/installer" | php && \
mv "composer.phar" "/usr/local/bin/composer" && \
composer global require --no-interaction "phpunit/phpunit"
ENV PATH /root/.composer/vendor/bin:$PATH
CMD ["bash"]
-3
View File
@@ -1,3 +0,0 @@
# Attach to running container.
docker exec --interactive --tty "php53" bash -l
-23
View File
@@ -1,23 +0,0 @@
bash "1_build.sh"
if [[ $? -ne 0 ]]; then
echo "Error: Build failed"
exit 1
fi
bash "2_start.sh"
if [[ $? -ne 0 ]]; then
echo "Error: Start failed"
exit 1
fi
bash "3_test.sh"
if [[ $? -ne 0 ]]; then
echo "Error: Test failed"
exit 1
fi
bash "4_stop.sh"
if [[ $? -ne 0 ]]; then
echo "Error: Stop failed"
exit 1
fi
@@ -1,14 +0,0 @@
# Run image to create container and attach to it.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
set -x
cd "${SCRIPT_DIR}/../../.."
project_dir="${PWD}"
docker run \
--interactive \
--mount "type=bind,src=${project_dir},dst=/data,readonly=true" \
--name="php53" \
--rm \
--tty \
"php-curl-class/php53" /bin/bash
-3
View File
@@ -1,3 +0,0 @@
# Build an image.
set -x
docker build --tag="php-curl-class/php54" .
-15
View File
@@ -1,15 +0,0 @@
# Run image to create container.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
set -x
cd "${SCRIPT_DIR}/../../.."
project_dir="${PWD}"
docker start "php54" ||
docker run \
--detach \
--interactive \
--mount "type=bind,src=${project_dir},dst=/data,readonly=true" \
--name="php54" \
--tty \
"php-curl-class/php54"
-18
View File
@@ -1,18 +0,0 @@
# Run tests inside container.
command=$(cat <<-END
mkdir --parents "/tmp/php-curl-class" &&
rsync --delete --exclude=".git" --exclude="vendor" --exclude="composer.lock" --links --recursive "/data/" "/tmp/php-curl-class/" &&
cd "/tmp/php-curl-class" &&
export CI_PHP_VERSION="5.4" &&
(
[ ! -f "/tmp/.composer_updated" ] &&
composer --no-interaction update &&
touch "/tmp/.composer_updated" ||
exit 0
) &&
bash "tests/before_script.sh" &&
bash "tests/script.sh"
END
)
set -x
docker exec --tty "php54" sh -c "${command}"
-3
View File
@@ -1,3 +0,0 @@
# Stop container.
set -x
docker stop "php54"
-30
View File
@@ -1,30 +0,0 @@
FROM php:5.4-fpm
ENV DEBIAN_FRONTEND noninteractive
# Fix error:
# "W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/InRelease Unable to find expected
# entry 'main/binary-amd64/Packages' in Release file (Wrong sources.list entry or malformed file)
# E: Some index files failed to download. They have been ignored, or old ones used instead."
RUN printf "%s\n" \
"deb http://archive.debian.org/debian/ jessie main" \
"deb-src http://archive.debian.org/debian/ jessie main" \
"deb http://security.debian.org jessie/updates main" \
"deb-src http://security.debian.org jessie/updates main" \
> /etc/apt/sources.list
RUN apt-get --assume-yes --quiet update
RUN apt-get --assume-yes --quiet install git && \
apt-get --assume-yes --quiet install libpng-dev && \
apt-get --assume-yes --quiet install zip
RUN curl --silent --show-error "https://getcomposer.org/installer" | php && \
mv "composer.phar" "/usr/local/bin/composer" && \
composer global require --no-interaction "phpunit/phpunit"
RUN docker-php-ext-configure gd && \
docker-php-ext-install gd && \
docker-php-ext-install mbstring
ENV PATH /root/.composer/vendor/bin:$PATH
CMD ["bash"]
-3
View File
@@ -1,3 +0,0 @@
# Attach to running container.
docker exec --interactive --tty "php54" bash -l
-23
View File
@@ -1,23 +0,0 @@
bash "1_build.sh"
if [[ $? -ne 0 ]]; then
echo "Error: Build failed"
exit 1
fi
bash "2_start.sh"
if [[ $? -ne 0 ]]; then
echo "Error: Start failed"
exit 1
fi
bash "3_test.sh"
if [[ $? -ne 0 ]]; then
echo "Error: Test failed"
exit 1
fi
bash "4_stop.sh"
if [[ $? -ne 0 ]]; then
echo "Error: Stop failed"
exit 1
fi
@@ -1,14 +0,0 @@
# Run image to create container and attach to it.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
set -x
cd "${SCRIPT_DIR}/../../.."
project_dir="${PWD}"
docker run \
--interactive \
--mount "type=bind,src=${project_dir},dst=/data,readonly=true" \
--name="php54" \
--rm \
--tty \
"php-curl-class/php54" /bin/bash
-3
View File
@@ -1,3 +0,0 @@
# Build an image.
set -x
docker build --tag="php-curl-class/php55" .
-15
View File
@@ -1,15 +0,0 @@
# Run image to create container.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
set -x
cd "${SCRIPT_DIR}/../../.."
project_dir="${PWD}"
docker start "php55" ||
docker run \
--detach \
--interactive \
--mount "type=bind,src=${project_dir},dst=/data,readonly=true" \
--name="php55" \
--tty \
"php-curl-class/php55"
-18
View File
@@ -1,18 +0,0 @@
# Run tests inside container.
command=$(cat <<-END
mkdir --parents "/tmp/php-curl-class" &&
rsync --delete --exclude=".git" --exclude="vendor" --exclude="composer.lock" --links --recursive "/data/" "/tmp/php-curl-class/" &&
cd "/tmp/php-curl-class" &&
export CI_PHP_VERSION="5.5" &&
(
[ ! -f "/tmp/.composer_updated" ] &&
composer --no-interaction update &&
touch "/tmp/.composer_updated" ||
exit 0
) &&
bash "tests/before_script.sh" &&
bash "tests/script.sh"
END
)
set -x
docker exec --tty "php55" sh -c "${command}"
-3
View File
@@ -1,3 +0,0 @@
# Stop container.
set -x
docker stop "php55"
-27
View File
@@ -1,27 +0,0 @@
FROM php:5.5-fpm
ENV DEBIAN_FRONTEND noninteractive
# Fix error:
# "E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?".
RUN printf "%s\n" \
"deb http://archive.debian.org/debian/ jessie main" \
"deb-src http://archive.debian.org/debian/ jessie main" \
"deb http://security.debian.org jessie/updates main" \
"deb-src http://security.debian.org jessie/updates main" \
> /etc/apt/sources.list
RUN apt-get --assume-yes --quiet update
RUN apt-get --assume-yes --quiet install git && \
apt-get --assume-yes --quiet install libpng-dev && \
apt-get --assume-yes --quiet install zip
RUN curl --silent --show-error "https://getcomposer.org/installer" | php && \
mv "composer.phar" "/usr/local/bin/composer" && \
composer global require --no-interaction "phpunit/phpunit"
RUN docker-php-ext-configure gd && \
docker-php-ext-install gd
ENV PATH /root/.composer/vendor/bin:$PATH
CMD ["bash"]
-3
View File
@@ -1,3 +0,0 @@
# Attach to running container.
docker exec --interactive --tty "php55" bash -l
-23
View File
@@ -1,23 +0,0 @@
bash "1_build.sh"
if [[ $? -ne 0 ]]; then
echo "Error: Build failed"
exit 1
fi
bash "2_start.sh"
if [[ $? -ne 0 ]]; then
echo "Error: Start failed"
exit 1
fi
bash "3_test.sh"
if [[ $? -ne 0 ]]; then
echo "Error: Test failed"
exit 1
fi
bash "4_stop.sh"
if [[ $? -ne 0 ]]; then
echo "Error: Stop failed"
exit 1
fi
@@ -1,14 +0,0 @@
# Run image to create container and attach to it.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
set -x
cd "${SCRIPT_DIR}/../../.."
project_dir="${PWD}"
docker run \
--interactive \
--mount "type=bind,src=${project_dir},dst=/data,readonly=true" \
--name="php55" \
--rm \
--tty \
"php-curl-class/php55" /bin/bash
-3
View File
@@ -1,3 +0,0 @@
# Build an image.
set -x
docker build --tag="php-curl-class/php56" .
-15
View File
@@ -1,15 +0,0 @@
# Run image to create container.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
set -x
cd "${SCRIPT_DIR}/../../.."
project_dir="${PWD}"
docker start "php56" ||
docker run \
--detach \
--interactive \
--mount "type=bind,src=${project_dir},dst=/data,readonly=true" \
--name="php56" \
--tty \
"php-curl-class/php56"
-18
View File
@@ -1,18 +0,0 @@
# Run tests inside container.
command=$(cat <<-END
mkdir --parents "/tmp/php-curl-class" &&
rsync --delete --exclude=".git" --exclude="vendor" --exclude="composer.lock" --links --recursive "/data/" "/tmp/php-curl-class/" &&
cd "/tmp/php-curl-class" &&
export CI_PHP_VERSION="5.6" &&
(
[ ! -f "/tmp/.composer_updated" ] &&
composer --no-interaction update &&
touch "/tmp/.composer_updated" ||
exit 0
) &&
bash "tests/before_script.sh" &&
bash "tests/script.sh"
END
)
set -x
docker exec --tty "php56" sh -c "${command}"
-3
View File
@@ -1,3 +0,0 @@
# Stop container.
set -x
docker stop "php56"
-18
View File
@@ -1,18 +0,0 @@
FROM php:5.6-fpm
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get --assume-yes --quiet update
RUN apt-get --assume-yes --quiet install git && \
apt-get --assume-yes --quiet install libpng-dev && \
apt-get --assume-yes --quiet install zip
RUN curl --silent --show-error "https://getcomposer.org/installer" | php && \
mv "composer.phar" "/usr/local/bin/composer" && \
composer global require --no-interaction "phpunit/phpunit"
RUN docker-php-ext-configure gd && \
docker-php-ext-install gd
ENV PATH /root/.composer/vendor/bin:$PATH
CMD ["bash"]
-3
View File
@@ -1,3 +0,0 @@
# Attach to running container.
docker exec --interactive --tty "php56" bash -l
-23
View File
@@ -1,23 +0,0 @@
bash "1_build.sh"
if [[ $? -ne 0 ]]; then
echo "Error: Build failed"
exit 1
fi
bash "2_start.sh"
if [[ $? -ne 0 ]]; then
echo "Error: Start failed"
exit 1
fi
bash "3_test.sh"
if [[ $? -ne 0 ]]; then
echo "Error: Test failed"
exit 1
fi
bash "4_stop.sh"
if [[ $? -ne 0 ]]; then
echo "Error: Stop failed"
exit 1
fi
@@ -1,14 +0,0 @@
# Run image to create container and attach to it.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
set -x
cd "${SCRIPT_DIR}/../../.."
project_dir="${PWD}"
docker run \
--interactive \
--mount "type=bind,src=${project_dir},dst=/data,readonly=true" \
--name="php56" \
--rm \
--tty \
"php-curl-class/php56" /bin/bash