From 26e6a966dfe8c8f33f225f4c94a757747b0e72ec Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Sat, 28 Jul 2018 13:40:33 -0700 Subject: [PATCH 1/7] Add allowed error that occurs when running unit tests inside container --- tests/PHPCurlClass/PHPCurlClassTest.php | 2 +- tests/PHPCurlClass/PHPMultiCurlClassTest.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/PHPCurlClass/PHPCurlClassTest.php b/tests/PHPCurlClass/PHPCurlClassTest.php index 8737c17..f4e245d 100644 --- a/tests/PHPCurlClass/PHPCurlClassTest.php +++ b/tests/PHPCurlClass/PHPCurlClassTest.php @@ -1106,7 +1106,7 @@ class CurlTest extends \PHPUnit\Framework\TestCase $test->curl->get(Test::ERROR_URL); $this->assertTrue($test->curl->error); $this->assertTrue($test->curl->curlError); - $possible_errors = array(CURLE_SEND_ERROR, CURLE_OPERATION_TIMEOUTED, CURLE_COULDNT_CONNECT); + $possible_errors = array(CURLE_SEND_ERROR, CURLE_OPERATION_TIMEOUTED, CURLE_COULDNT_CONNECT, CURLE_GOT_NOTHING); $this->assertTrue( in_array($test->curl->errorCode, $possible_errors, true), 'errorCode: ' . $test->curl->errorCode diff --git a/tests/PHPCurlClass/PHPMultiCurlClassTest.php b/tests/PHPCurlClass/PHPMultiCurlClassTest.php index 1540d85..00debce 100644 --- a/tests/PHPCurlClass/PHPMultiCurlClassTest.php +++ b/tests/PHPCurlClass/PHPMultiCurlClassTest.php @@ -601,7 +601,8 @@ class MultiCurlTest extends \PHPUnit\Framework\TestCase \PHPUnit\Framework\Assert::assertTrue($instance->error); \PHPUnit\Framework\Assert::assertTrue($instance->curlError); \PHPUnit\Framework\Assert::assertFalse($instance->httpError); - $possible_errors = array(CURLE_SEND_ERROR, CURLE_OPERATION_TIMEOUTED, CURLE_COULDNT_CONNECT); + $possible_errors = array( + CURLE_SEND_ERROR, CURLE_OPERATION_TIMEOUTED, CURLE_COULDNT_CONNECT, CURLE_GOT_NOTHING); \PHPUnit\Framework\Assert::assertTrue( in_array($instance->errorCode, $possible_errors, true), 'errorCode: ' . $instance->errorCode From 7edaee784d67cd44abdaa6f689e0e42dc2c6e363 Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Sat, 28 Jul 2018 22:44:01 -0700 Subject: [PATCH 2/7] Add files to run php56 tests inside a docker container --- tests/dockerfiles/php56/1_build.sh | 2 ++ tests/dockerfiles/php56/2_run.sh | 14 ++++++++++++++ tests/dockerfiles/php56/3_test.sh | 17 +++++++++++++++++ tests/dockerfiles/php56/Dockerfile | 18 ++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100755 tests/dockerfiles/php56/1_build.sh create mode 100755 tests/dockerfiles/php56/2_run.sh create mode 100755 tests/dockerfiles/php56/3_test.sh create mode 100644 tests/dockerfiles/php56/Dockerfile diff --git a/tests/dockerfiles/php56/1_build.sh b/tests/dockerfiles/php56/1_build.sh new file mode 100755 index 0000000..2135baa --- /dev/null +++ b/tests/dockerfiles/php56/1_build.sh @@ -0,0 +1,2 @@ +# Build an image. +docker build --tag="php-curl-class/php56" . diff --git a/tests/dockerfiles/php56/2_run.sh b/tests/dockerfiles/php56/2_run.sh new file mode 100755 index 0000000..3afbf98 --- /dev/null +++ b/tests/dockerfiles/php56/2_run.sh @@ -0,0 +1,14 @@ +# 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 diff --git a/tests/dockerfiles/php56/3_test.sh b/tests/dockerfiles/php56/3_test.sh new file mode 100755 index 0000000..5441411 --- /dev/null +++ b/tests/dockerfiles/php56/3_test.sh @@ -0,0 +1,17 @@ +# Run tests inside container. +command=$(cat <<-END +mkdir --parents "/tmp/php-curl-class" && +rsync --exclude=".git" --exclude="vendor" --links --recursive "/data/" "/tmp/php-curl-class/" && +cd "/tmp/php-curl-class" && +export TRAVIS_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 +) +docker exec --interactive --tty "php56" sh -c "${command}" diff --git a/tests/dockerfiles/php56/Dockerfile b/tests/dockerfiles/php56/Dockerfile new file mode 100644 index 0000000..467c99f --- /dev/null +++ b/tests/dockerfiles/php56/Dockerfile @@ -0,0 +1,18 @@ +FROM php:5.6-cli +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"] From 5be7bd6aacaf13e0120f93419e83ba7bb875b8dd Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Sat, 28 Jul 2018 23:03:44 -0700 Subject: [PATCH 3/7] Add files to run php70 tests inside a docker container --- tests/dockerfiles/php70/1_build.sh | 2 ++ tests/dockerfiles/php70/2_run.sh | 14 ++++++++++++++ tests/dockerfiles/php70/3_test.sh | 17 +++++++++++++++++ tests/dockerfiles/php70/Dockerfile | 18 ++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100755 tests/dockerfiles/php70/1_build.sh create mode 100755 tests/dockerfiles/php70/2_run.sh create mode 100755 tests/dockerfiles/php70/3_test.sh create mode 100644 tests/dockerfiles/php70/Dockerfile diff --git a/tests/dockerfiles/php70/1_build.sh b/tests/dockerfiles/php70/1_build.sh new file mode 100755 index 0000000..538dde6 --- /dev/null +++ b/tests/dockerfiles/php70/1_build.sh @@ -0,0 +1,2 @@ +# Build an image. +docker build --tag="php-curl-class/php70" . diff --git a/tests/dockerfiles/php70/2_run.sh b/tests/dockerfiles/php70/2_run.sh new file mode 100755 index 0000000..dd22d52 --- /dev/null +++ b/tests/dockerfiles/php70/2_run.sh @@ -0,0 +1,14 @@ +# 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=php70 \ + --rm \ + --tty \ + "php-curl-class/php70" /bin/bash diff --git a/tests/dockerfiles/php70/3_test.sh b/tests/dockerfiles/php70/3_test.sh new file mode 100755 index 0000000..3ae58dd --- /dev/null +++ b/tests/dockerfiles/php70/3_test.sh @@ -0,0 +1,17 @@ +# Run tests inside container. +command=$(cat <<-END +mkdir --parents "/tmp/php-curl-class" && +rsync --exclude=".git" --exclude="vendor" --links --recursive "/data/" "/tmp/php-curl-class/" && +cd "/tmp/php-curl-class" && +export TRAVIS_PHP_VERSION="7.0" && +( + [ ! -f "/tmp/.composer_updated" ] && + composer --no-interaction update && + touch "/tmp/.composer_updated" || + exit 0 +) && +bash "tests/before_script.sh" && +bash "tests/script.sh" +END +) +docker exec --interactive --tty "php70" sh -c "${command}" diff --git a/tests/dockerfiles/php70/Dockerfile b/tests/dockerfiles/php70/Dockerfile new file mode 100644 index 0000000..449fb18 --- /dev/null +++ b/tests/dockerfiles/php70/Dockerfile @@ -0,0 +1,18 @@ +FROM php:7.0-cli +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"] From d82ff51e4444057d8f6a12d72029376e23714865 Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Sat, 28 Jul 2018 23:09:55 -0700 Subject: [PATCH 4/7] Add files to run php71 tests inside a docker container --- tests/dockerfiles/php71/1_build.sh | 2 ++ tests/dockerfiles/php71/2_run.sh | 14 ++++++++++++++ tests/dockerfiles/php71/3_test.sh | 17 +++++++++++++++++ tests/dockerfiles/php71/Dockerfile | 18 ++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100755 tests/dockerfiles/php71/1_build.sh create mode 100755 tests/dockerfiles/php71/2_run.sh create mode 100755 tests/dockerfiles/php71/3_test.sh create mode 100644 tests/dockerfiles/php71/Dockerfile diff --git a/tests/dockerfiles/php71/1_build.sh b/tests/dockerfiles/php71/1_build.sh new file mode 100755 index 0000000..73008b0 --- /dev/null +++ b/tests/dockerfiles/php71/1_build.sh @@ -0,0 +1,2 @@ +# Build an image. +docker build --tag="php-curl-class/php71" . diff --git a/tests/dockerfiles/php71/2_run.sh b/tests/dockerfiles/php71/2_run.sh new file mode 100755 index 0000000..c87e8d9 --- /dev/null +++ b/tests/dockerfiles/php71/2_run.sh @@ -0,0 +1,14 @@ +# 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=php71 \ + --rm \ + --tty \ + "php-curl-class/php71" /bin/bash diff --git a/tests/dockerfiles/php71/3_test.sh b/tests/dockerfiles/php71/3_test.sh new file mode 100755 index 0000000..09f4565 --- /dev/null +++ b/tests/dockerfiles/php71/3_test.sh @@ -0,0 +1,17 @@ +# Run tests inside container. +command=$(cat <<-END +mkdir --parents "/tmp/php-curl-class" && +rsync --exclude=".git" --exclude="vendor" --links --recursive "/data/" "/tmp/php-curl-class/" && +cd "/tmp/php-curl-class" && +export TRAVIS_PHP_VERSION="7.1" && +( + [ ! -f "/tmp/.composer_updated" ] && + composer --no-interaction update && + touch "/tmp/.composer_updated" || + exit 0 +) && +bash "tests/before_script.sh" && +bash "tests/script.sh" +END +) +docker exec --interactive --tty "php71" sh -c "${command}" diff --git a/tests/dockerfiles/php71/Dockerfile b/tests/dockerfiles/php71/Dockerfile new file mode 100644 index 0000000..7fc525c --- /dev/null +++ b/tests/dockerfiles/php71/Dockerfile @@ -0,0 +1,18 @@ +FROM php:7.1-cli +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"] From fb698471e64bcd0b98411ce7423878a604a63edd Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Sat, 28 Jul 2018 23:12:38 -0700 Subject: [PATCH 5/7] Add files to run php72 tests inside a docker container --- tests/dockerfiles/php72/1_build.sh | 2 ++ tests/dockerfiles/php72/2_run.sh | 14 ++++++++++++++ tests/dockerfiles/php72/3_test.sh | 17 +++++++++++++++++ tests/dockerfiles/php72/Dockerfile | 18 ++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100755 tests/dockerfiles/php72/1_build.sh create mode 100755 tests/dockerfiles/php72/2_run.sh create mode 100755 tests/dockerfiles/php72/3_test.sh create mode 100644 tests/dockerfiles/php72/Dockerfile diff --git a/tests/dockerfiles/php72/1_build.sh b/tests/dockerfiles/php72/1_build.sh new file mode 100755 index 0000000..5d52a06 --- /dev/null +++ b/tests/dockerfiles/php72/1_build.sh @@ -0,0 +1,2 @@ +# Build an image. +docker build --tag="php-curl-class/php72" . diff --git a/tests/dockerfiles/php72/2_run.sh b/tests/dockerfiles/php72/2_run.sh new file mode 100755 index 0000000..11f9899 --- /dev/null +++ b/tests/dockerfiles/php72/2_run.sh @@ -0,0 +1,14 @@ +# 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=php72 \ + --rm \ + --tty \ + "php-curl-class/php72" /bin/bash diff --git a/tests/dockerfiles/php72/3_test.sh b/tests/dockerfiles/php72/3_test.sh new file mode 100755 index 0000000..6e73a6d --- /dev/null +++ b/tests/dockerfiles/php72/3_test.sh @@ -0,0 +1,17 @@ +# Run tests inside container. +command=$(cat <<-END +mkdir --parents "/tmp/php-curl-class" && +rsync --exclude=".git" --exclude="vendor" --links --recursive "/data/" "/tmp/php-curl-class/" && +cd "/tmp/php-curl-class" && +export TRAVIS_PHP_VERSION="7.2" && +( + [ ! -f "/tmp/.composer_updated" ] && + composer --no-interaction update && + touch "/tmp/.composer_updated" || + exit 0 +) && +bash "tests/before_script.sh" && +bash "tests/script.sh" +END +) +docker exec --interactive --tty "php72" sh -c "${command}" diff --git a/tests/dockerfiles/php72/Dockerfile b/tests/dockerfiles/php72/Dockerfile new file mode 100644 index 0000000..ba368ed --- /dev/null +++ b/tests/dockerfiles/php72/Dockerfile @@ -0,0 +1,18 @@ +FROM php:7.2-cli +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"] From 957bee4c762308cf54060b46e095863db999f951 Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Sun, 29 Jul 2018 00:14:56 -0700 Subject: [PATCH 6/7] Add script to run tests in all docker images --- tests/dockerfiles/php56/2_start.sh | 15 +++++++++++++++ tests/dockerfiles/php56/4_stop.sh | 3 +++ .../php56/{2_run.sh => run_interactive.sh} | 2 +- tests/dockerfiles/php70/2_start.sh | 15 +++++++++++++++ tests/dockerfiles/php70/4_stop.sh | 3 +++ .../php70/{2_run.sh => run_interactive.sh} | 2 +- tests/dockerfiles/php71/2_start.sh | 15 +++++++++++++++ tests/dockerfiles/php71/4_stop.sh | 3 +++ .../php71/{2_run.sh => run_interactive.sh} | 2 +- tests/dockerfiles/php72/2_start.sh | 15 +++++++++++++++ tests/dockerfiles/php72/4_stop.sh | 3 +++ .../php72/{2_run.sh => run_interactive.sh} | 2 +- tests/test_all.sh | 12 ++++++++++++ 13 files changed, 88 insertions(+), 4 deletions(-) create mode 100755 tests/dockerfiles/php56/2_start.sh create mode 100755 tests/dockerfiles/php56/4_stop.sh rename tests/dockerfiles/php56/{2_run.sh => run_interactive.sh} (94%) create mode 100644 tests/dockerfiles/php70/2_start.sh create mode 100644 tests/dockerfiles/php70/4_stop.sh rename tests/dockerfiles/php70/{2_run.sh => run_interactive.sh} (94%) create mode 100644 tests/dockerfiles/php71/2_start.sh create mode 100644 tests/dockerfiles/php71/4_stop.sh rename tests/dockerfiles/php71/{2_run.sh => run_interactive.sh} (94%) create mode 100644 tests/dockerfiles/php72/2_start.sh create mode 100644 tests/dockerfiles/php72/4_stop.sh rename tests/dockerfiles/php72/{2_run.sh => run_interactive.sh} (94%) create mode 100755 tests/test_all.sh diff --git a/tests/dockerfiles/php56/2_start.sh b/tests/dockerfiles/php56/2_start.sh new file mode 100755 index 0000000..c3c6649 --- /dev/null +++ b/tests/dockerfiles/php56/2_start.sh @@ -0,0 +1,15 @@ +# 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/4_stop.sh b/tests/dockerfiles/php56/4_stop.sh new file mode 100755 index 0000000..4696c12 --- /dev/null +++ b/tests/dockerfiles/php56/4_stop.sh @@ -0,0 +1,3 @@ +# Stop container. + +docker stop "php56" diff --git a/tests/dockerfiles/php56/2_run.sh b/tests/dockerfiles/php56/run_interactive.sh similarity index 94% rename from tests/dockerfiles/php56/2_run.sh rename to tests/dockerfiles/php56/run_interactive.sh index 3afbf98..5b4c337 100755 --- a/tests/dockerfiles/php56/2_run.sh +++ b/tests/dockerfiles/php56/run_interactive.sh @@ -8,7 +8,7 @@ project_dir="${PWD}" docker run \ --interactive \ --mount "type=bind,src=${project_dir},dst=/data,readonly=true" \ - --name=php56 \ + --name="php56" \ --rm \ --tty \ "php-curl-class/php56" /bin/bash diff --git a/tests/dockerfiles/php70/2_start.sh b/tests/dockerfiles/php70/2_start.sh new file mode 100644 index 0000000..baed9f4 --- /dev/null +++ b/tests/dockerfiles/php70/2_start.sh @@ -0,0 +1,15 @@ +# Run image to create container. + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +set -x +cd "${SCRIPT_DIR}/../../.." +project_dir="${PWD}" + +docker start "php70" || + docker run \ + --detach \ + --interactive \ + --mount "type=bind,src=${project_dir},dst=/data,readonly=true" \ + --name="php70" \ + --tty \ + "php-curl-class/php70" diff --git a/tests/dockerfiles/php70/4_stop.sh b/tests/dockerfiles/php70/4_stop.sh new file mode 100644 index 0000000..8c3fc0d --- /dev/null +++ b/tests/dockerfiles/php70/4_stop.sh @@ -0,0 +1,3 @@ +# Stop container. + +docker stop "php70" diff --git a/tests/dockerfiles/php70/2_run.sh b/tests/dockerfiles/php70/run_interactive.sh similarity index 94% rename from tests/dockerfiles/php70/2_run.sh rename to tests/dockerfiles/php70/run_interactive.sh index dd22d52..a089e63 100755 --- a/tests/dockerfiles/php70/2_run.sh +++ b/tests/dockerfiles/php70/run_interactive.sh @@ -8,7 +8,7 @@ project_dir="${PWD}" docker run \ --interactive \ --mount "type=bind,src=${project_dir},dst=/data,readonly=true" \ - --name=php70 \ + --name="php70" \ --rm \ --tty \ "php-curl-class/php70" /bin/bash diff --git a/tests/dockerfiles/php71/2_start.sh b/tests/dockerfiles/php71/2_start.sh new file mode 100644 index 0000000..9d81dc8 --- /dev/null +++ b/tests/dockerfiles/php71/2_start.sh @@ -0,0 +1,15 @@ +# Run image to create container. + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +set -x +cd "${SCRIPT_DIR}/../../.." +project_dir="${PWD}" + +docker start "php71" || + docker run \ + --detach \ + --interactive \ + --mount "type=bind,src=${project_dir},dst=/data,readonly=true" \ + --name="php71" \ + --tty \ + "php-curl-class/php71" diff --git a/tests/dockerfiles/php71/4_stop.sh b/tests/dockerfiles/php71/4_stop.sh new file mode 100644 index 0000000..1214852 --- /dev/null +++ b/tests/dockerfiles/php71/4_stop.sh @@ -0,0 +1,3 @@ +# Stop container. + +docker stop "php71" diff --git a/tests/dockerfiles/php71/2_run.sh b/tests/dockerfiles/php71/run_interactive.sh similarity index 94% rename from tests/dockerfiles/php71/2_run.sh rename to tests/dockerfiles/php71/run_interactive.sh index c87e8d9..d0ec358 100755 --- a/tests/dockerfiles/php71/2_run.sh +++ b/tests/dockerfiles/php71/run_interactive.sh @@ -8,7 +8,7 @@ project_dir="${PWD}" docker run \ --interactive \ --mount "type=bind,src=${project_dir},dst=/data,readonly=true" \ - --name=php71 \ + --name="php71" \ --rm \ --tty \ "php-curl-class/php71" /bin/bash diff --git a/tests/dockerfiles/php72/2_start.sh b/tests/dockerfiles/php72/2_start.sh new file mode 100644 index 0000000..e7c3e8b --- /dev/null +++ b/tests/dockerfiles/php72/2_start.sh @@ -0,0 +1,15 @@ +# Run image to create container. + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +set -x +cd "${SCRIPT_DIR}/../../.." +project_dir="${PWD}" + +docker start "php72" || + docker run \ + --detach \ + --interactive \ + --mount "type=bind,src=${project_dir},dst=/data,readonly=true" \ + --name="php72" \ + --tty \ + "php-curl-class/php72" diff --git a/tests/dockerfiles/php72/4_stop.sh b/tests/dockerfiles/php72/4_stop.sh new file mode 100644 index 0000000..0d45de2 --- /dev/null +++ b/tests/dockerfiles/php72/4_stop.sh @@ -0,0 +1,3 @@ +# Stop container. + +docker stop "php72" diff --git a/tests/dockerfiles/php72/2_run.sh b/tests/dockerfiles/php72/run_interactive.sh similarity index 94% rename from tests/dockerfiles/php72/2_run.sh rename to tests/dockerfiles/php72/run_interactive.sh index 11f9899..df7fe12 100755 --- a/tests/dockerfiles/php72/2_run.sh +++ b/tests/dockerfiles/php72/run_interactive.sh @@ -8,7 +8,7 @@ project_dir="${PWD}" docker run \ --interactive \ --mount "type=bind,src=${project_dir},dst=/data,readonly=true" \ - --name=php72 \ + --name="php72" \ --rm \ --tty \ "php-curl-class/php72" /bin/bash diff --git a/tests/test_all.sh b/tests/test_all.sh new file mode 100755 index 0000000..488a6f9 --- /dev/null +++ b/tests/test_all.sh @@ -0,0 +1,12 @@ +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +cd "${SCRIPT_DIR}" + +for d in "dockerfiles/"* ; do + echo "Running ${d}" && + pushd "${d}" && + bash "1_build.sh" && + bash "2_start.sh" && + bash "3_test.sh" && + bash "4_stop.sh" && + popd +done From 860c9ff968c673da3d9da2f525933dc9bc858801 Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Sun, 29 Jul 2018 00:27:49 -0700 Subject: [PATCH 7/7] Add run container tests section --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 28ab4db..15b5abd 100644 --- a/README.md +++ b/README.md @@ -349,7 +349,12 @@ To run tests: $ composer update $ ./tests/run.sh +To run all container tests: + + $ ./tests/test_all.sh + ### Contribute + 1. Check for open issues or open a new issue to start a discussion around a bug or feature. 1. Fork the repository on GitHub to start making your changes. 1. Write one or more tests for the new feature or that expose the bug.