From cc3f7bac24e3659c8bca351dfd073d270b011da7 Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Wed, 17 Mar 2021 12:19:38 -0400 Subject: [PATCH] Remove PHP v5.x support and add basic doc for how one may install the old version --- README.md | 2 +- composer.json | 2 +- docs/v5.x.md | 9 ++ src/Curl/Curl.php | 30 +---- src/Curl/Decoder.php | 8 -- src/Curl/Encoder.php | 8 -- tests/PHPCurlClass/PHPCurlClassTest.php | 44 +------ tests/before_script.sh | 129 +-------------------- tests/dockerfiles/php53/1_build.sh | 3 - tests/dockerfiles/php53/2_start.sh | 15 --- tests/dockerfiles/php53/3_test.sh | 18 --- tests/dockerfiles/php53/4_stop.sh | 3 - tests/dockerfiles/php53/Dockerfile | 66 ----------- tests/dockerfiles/php53/attach.sh | 3 - tests/dockerfiles/php53/run.sh | 23 ---- tests/dockerfiles/php53/run_interactive.sh | 14 --- tests/dockerfiles/php54/1_build.sh | 3 - tests/dockerfiles/php54/2_start.sh | 15 --- tests/dockerfiles/php54/3_test.sh | 18 --- tests/dockerfiles/php54/4_stop.sh | 3 - tests/dockerfiles/php54/Dockerfile | 30 ----- tests/dockerfiles/php54/attach.sh | 3 - tests/dockerfiles/php54/run.sh | 23 ---- tests/dockerfiles/php54/run_interactive.sh | 14 --- tests/dockerfiles/php55/1_build.sh | 3 - tests/dockerfiles/php55/2_start.sh | 15 --- tests/dockerfiles/php55/3_test.sh | 18 --- tests/dockerfiles/php55/4_stop.sh | 3 - tests/dockerfiles/php55/Dockerfile | 27 ----- tests/dockerfiles/php55/attach.sh | 3 - tests/dockerfiles/php55/run.sh | 23 ---- tests/dockerfiles/php55/run_interactive.sh | 14 --- tests/dockerfiles/php56/1_build.sh | 3 - tests/dockerfiles/php56/2_start.sh | 15 --- tests/dockerfiles/php56/3_test.sh | 18 --- tests/dockerfiles/php56/4_stop.sh | 3 - tests/dockerfiles/php56/Dockerfile | 18 --- tests/dockerfiles/php56/attach.sh | 3 - tests/dockerfiles/php56/run.sh | 23 ---- tests/dockerfiles/php56/run_interactive.sh | 14 --- 40 files changed, 19 insertions(+), 670 deletions(-) create mode 100644 docs/v5.x.md delete mode 100755 tests/dockerfiles/php53/1_build.sh delete mode 100755 tests/dockerfiles/php53/2_start.sh delete mode 100755 tests/dockerfiles/php53/3_test.sh delete mode 100755 tests/dockerfiles/php53/4_stop.sh delete mode 100644 tests/dockerfiles/php53/Dockerfile delete mode 100755 tests/dockerfiles/php53/attach.sh delete mode 100755 tests/dockerfiles/php53/run.sh delete mode 100755 tests/dockerfiles/php53/run_interactive.sh delete mode 100755 tests/dockerfiles/php54/1_build.sh delete mode 100755 tests/dockerfiles/php54/2_start.sh delete mode 100755 tests/dockerfiles/php54/3_test.sh delete mode 100755 tests/dockerfiles/php54/4_stop.sh delete mode 100644 tests/dockerfiles/php54/Dockerfile delete mode 100755 tests/dockerfiles/php54/attach.sh delete mode 100755 tests/dockerfiles/php54/run.sh delete mode 100755 tests/dockerfiles/php54/run_interactive.sh delete mode 100755 tests/dockerfiles/php55/1_build.sh delete mode 100755 tests/dockerfiles/php55/2_start.sh delete mode 100755 tests/dockerfiles/php55/3_test.sh delete mode 100755 tests/dockerfiles/php55/4_stop.sh delete mode 100644 tests/dockerfiles/php55/Dockerfile delete mode 100755 tests/dockerfiles/php55/attach.sh delete mode 100755 tests/dockerfiles/php55/run.sh delete mode 100755 tests/dockerfiles/php55/run_interactive.sh delete mode 100755 tests/dockerfiles/php56/1_build.sh delete mode 100755 tests/dockerfiles/php56/2_start.sh delete mode 100755 tests/dockerfiles/php56/3_test.sh delete mode 100755 tests/dockerfiles/php56/4_stop.sh delete mode 100644 tests/dockerfiles/php56/Dockerfile delete mode 100755 tests/dockerfiles/php56/attach.sh delete mode 100755 tests/dockerfiles/php56/run.sh delete mode 100755 tests/dockerfiles/php56/run_interactive.sh diff --git a/README.md b/README.md index 653766e..716a45f 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/composer.json b/composer.json index 46d6986..7508615 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": ">=5.3", + "php": ">=7.0", "ext-curl": "*" }, "require-dev": { diff --git a/docs/v5.x.md b/docs/v5.x.md new file mode 100644 index 0000000..6296857 --- /dev/null +++ b/docs/v5.x.md @@ -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 diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index abbf7c7..3b3c500 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -710,17 +710,7 @@ 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_CUSTOMREQUEST, null); } } @@ -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; - }; - } - + $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; + }; $this->progress($callback); } diff --git a/src/Curl/Decoder.php b/src/Curl/Decoder.php index eb50c15..3170811 100644 --- a/src/Curl/Decoder.php +++ b/src/Curl/Decoder.php @@ -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']; diff --git a/src/Curl/Encoder.php b/src/Curl/Encoder.php index ffe7ced..a0947ee 100644 --- a/src/Curl/Encoder.php +++ b/src/Curl/Encoder.php @@ -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')) { diff --git a/tests/PHPCurlClass/PHPCurlClassTest.php b/tests/PHPCurlClass/PHPCurlClassTest.php index 9090f4f..eb1317a 100644 --- a/tests/PHPCurlClass/PHPCurlClassTest.php +++ b/tests/PHPCurlClass/PHPCurlClassTest.php @@ -497,35 +497,8 @@ 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) { - $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); - } + // Ensure that it is possible to reuse an existing Curl object. + $this->assertEquals('Redirected: GET', $test->server('post_redirect_get', 'POST')); } 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); } diff --git a/tests/before_script.sh b/tests/before_script.sh index c7112d6..4bcbe5e 100755 --- a/tests/before_script.sh +++ b/tests/before_script.sh @@ -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 <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 </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"] diff --git a/tests/dockerfiles/php53/attach.sh b/tests/dockerfiles/php53/attach.sh deleted file mode 100755 index 52fa0c7..0000000 --- a/tests/dockerfiles/php53/attach.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Attach to running container. - -docker exec --interactive --tty "php53" bash -l diff --git a/tests/dockerfiles/php53/run.sh b/tests/dockerfiles/php53/run.sh deleted file mode 100755 index ced63cf..0000000 --- a/tests/dockerfiles/php53/run.sh +++ /dev/null @@ -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 diff --git a/tests/dockerfiles/php53/run_interactive.sh b/tests/dockerfiles/php53/run_interactive.sh deleted file mode 100755 index 9f2d433..0000000 --- a/tests/dockerfiles/php53/run_interactive.sh +++ /dev/null @@ -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 diff --git a/tests/dockerfiles/php54/1_build.sh b/tests/dockerfiles/php54/1_build.sh deleted file mode 100755 index ba5a98d..0000000 --- a/tests/dockerfiles/php54/1_build.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Build an image. -set -x -docker build --tag="php-curl-class/php54" . diff --git a/tests/dockerfiles/php54/2_start.sh b/tests/dockerfiles/php54/2_start.sh deleted file mode 100755 index 6211746..0000000 --- a/tests/dockerfiles/php54/2_start.sh +++ /dev/null @@ -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" diff --git a/tests/dockerfiles/php54/3_test.sh b/tests/dockerfiles/php54/3_test.sh deleted file mode 100755 index 888458c..0000000 --- a/tests/dockerfiles/php54/3_test.sh +++ /dev/null @@ -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}" diff --git a/tests/dockerfiles/php54/4_stop.sh b/tests/dockerfiles/php54/4_stop.sh deleted file mode 100755 index 0bb3d47..0000000 --- a/tests/dockerfiles/php54/4_stop.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Stop container. -set -x -docker stop "php54" diff --git a/tests/dockerfiles/php54/Dockerfile b/tests/dockerfiles/php54/Dockerfile deleted file mode 100644 index bee9639..0000000 --- a/tests/dockerfiles/php54/Dockerfile +++ /dev/null @@ -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"] diff --git a/tests/dockerfiles/php54/attach.sh b/tests/dockerfiles/php54/attach.sh deleted file mode 100755 index 619b2b7..0000000 --- a/tests/dockerfiles/php54/attach.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Attach to running container. - -docker exec --interactive --tty "php54" bash -l diff --git a/tests/dockerfiles/php54/run.sh b/tests/dockerfiles/php54/run.sh deleted file mode 100755 index ced63cf..0000000 --- a/tests/dockerfiles/php54/run.sh +++ /dev/null @@ -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 diff --git a/tests/dockerfiles/php54/run_interactive.sh b/tests/dockerfiles/php54/run_interactive.sh deleted file mode 100755 index 487232f..0000000 --- a/tests/dockerfiles/php54/run_interactive.sh +++ /dev/null @@ -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 diff --git a/tests/dockerfiles/php55/1_build.sh b/tests/dockerfiles/php55/1_build.sh deleted file mode 100755 index 0921109..0000000 --- a/tests/dockerfiles/php55/1_build.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Build an image. -set -x -docker build --tag="php-curl-class/php55" . diff --git a/tests/dockerfiles/php55/2_start.sh b/tests/dockerfiles/php55/2_start.sh deleted file mode 100755 index 2db662d..0000000 --- a/tests/dockerfiles/php55/2_start.sh +++ /dev/null @@ -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" diff --git a/tests/dockerfiles/php55/3_test.sh b/tests/dockerfiles/php55/3_test.sh deleted file mode 100755 index 8e2788b..0000000 --- a/tests/dockerfiles/php55/3_test.sh +++ /dev/null @@ -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}" diff --git a/tests/dockerfiles/php55/4_stop.sh b/tests/dockerfiles/php55/4_stop.sh deleted file mode 100755 index 7be6aa4..0000000 --- a/tests/dockerfiles/php55/4_stop.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Stop container. -set -x -docker stop "php55" diff --git a/tests/dockerfiles/php55/Dockerfile b/tests/dockerfiles/php55/Dockerfile deleted file mode 100644 index 2f7bf7e..0000000 --- a/tests/dockerfiles/php55/Dockerfile +++ /dev/null @@ -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"] diff --git a/tests/dockerfiles/php55/attach.sh b/tests/dockerfiles/php55/attach.sh deleted file mode 100755 index 2a07019..0000000 --- a/tests/dockerfiles/php55/attach.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Attach to running container. - -docker exec --interactive --tty "php55" bash -l diff --git a/tests/dockerfiles/php55/run.sh b/tests/dockerfiles/php55/run.sh deleted file mode 100755 index ced63cf..0000000 --- a/tests/dockerfiles/php55/run.sh +++ /dev/null @@ -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 diff --git a/tests/dockerfiles/php55/run_interactive.sh b/tests/dockerfiles/php55/run_interactive.sh deleted file mode 100755 index dd472d3..0000000 --- a/tests/dockerfiles/php55/run_interactive.sh +++ /dev/null @@ -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 diff --git a/tests/dockerfiles/php56/1_build.sh b/tests/dockerfiles/php56/1_build.sh deleted file mode 100755 index 24a6913..0000000 --- a/tests/dockerfiles/php56/1_build.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Build an image. -set -x -docker build --tag="php-curl-class/php56" . diff --git a/tests/dockerfiles/php56/2_start.sh b/tests/dockerfiles/php56/2_start.sh deleted file mode 100755 index 9a977ce..0000000 --- a/tests/dockerfiles/php56/2_start.sh +++ /dev/null @@ -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" diff --git a/tests/dockerfiles/php56/3_test.sh b/tests/dockerfiles/php56/3_test.sh deleted file mode 100755 index 6568163..0000000 --- a/tests/dockerfiles/php56/3_test.sh +++ /dev/null @@ -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}" diff --git a/tests/dockerfiles/php56/4_stop.sh b/tests/dockerfiles/php56/4_stop.sh deleted file mode 100755 index 7c025be..0000000 --- a/tests/dockerfiles/php56/4_stop.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Stop container. -set -x -docker stop "php56" diff --git a/tests/dockerfiles/php56/Dockerfile b/tests/dockerfiles/php56/Dockerfile deleted file mode 100644 index 249d7db..0000000 --- a/tests/dockerfiles/php56/Dockerfile +++ /dev/null @@ -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"] diff --git a/tests/dockerfiles/php56/attach.sh b/tests/dockerfiles/php56/attach.sh deleted file mode 100755 index c7e8ae7..0000000 --- a/tests/dockerfiles/php56/attach.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Attach to running container. - -docker exec --interactive --tty "php56" bash -l diff --git a/tests/dockerfiles/php56/run.sh b/tests/dockerfiles/php56/run.sh deleted file mode 100755 index ced63cf..0000000 --- a/tests/dockerfiles/php56/run.sh +++ /dev/null @@ -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 diff --git a/tests/dockerfiles/php56/run_interactive.sh b/tests/dockerfiles/php56/run_interactive.sh deleted file mode 100755 index 5b4c337..0000000 --- a/tests/dockerfiles/php56/run_interactive.sh +++ /dev/null @@ -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