diff --git a/tests/.env-dist b/tests/.env-dist index ea4dfaa1f4..79f1da22b5 100644 --- a/tests/.env-dist +++ b/tests/.env-dist @@ -1,9 +1,6 @@ -# docker-compose test environment +COMPOSE_FILE=docker-compose.yml -# Configuration files -COMPOSE_FILE=docker-compose.yml:docker-compose.mysql.yml:docker-compose.pgsql.yml:docker-compose.caching.yml - -# Image versions -DOCKER_YII2_PHP_IMAGE=yiisoftware/yii2-php:7.2-apache -DOCKER_MYSQL_IMAGE=percona:5.7 +DOCKER_YII2_PHP_IMAGE=yiisoftware/yii2-php:8.4-apache +DOCKER_MYSQL_IMAGE=mysql DOCKER_POSTGRES_IMAGE=postgres +DOCKER_MEMCACHED_IMAGE=memcached diff --git a/tests/Dockerfile.caching b/tests/Dockerfile.caching new file mode 100644 index 0000000000..09602b0678 --- /dev/null +++ b/tests/Dockerfile.caching @@ -0,0 +1,9 @@ +FROM yiisoftware/yii2-php:8.4-apache + +RUN apt-get update && apt-get install -y --no-install-recommends libmemcached-dev zlib1g-dev libzip-dev +RUN pecl install memcached +RUN docker-php-ext-enable memcached + +WORKDIR /project +COPY ./ /project +RUN composer install --prefer-dist diff --git a/tests/Dockerfile.mssql b/tests/Dockerfile.mssql new file mode 100644 index 0000000000..e788c08bb2 --- /dev/null +++ b/tests/Dockerfile.mssql @@ -0,0 +1,14 @@ +FROM yiisoftware/yii2-php:8.4-apache + +RUN apt-get update && apt-get install -y --no-install-recommends curl gnupg unixodbc-dev +RUN pecl install sqlsrv pdo_sqlsrv +RUN docker-php-ext-enable sqlsrv pdo_sqlsrv + +# Note: Using Debian 12 (bookworm) repo since Trixie (13) is not yet officially supported by Microsoft +RUN curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg +RUN echo "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/microsoft-prod.gpg] https://packages.microsoft.com/debian/12/prod bookworm main" > /etc/apt/sources.list.d/mssql-release.list +RUN apt-get update && ACCEPT_EULA=Y apt-get install -y --no-install-recommends msodbcsql18 + +WORKDIR /project +COPY ./ /project +RUN composer install --prefer-dist diff --git a/tests/README.md b/tests/README.md index 11b110bbe0..274fbe91ec 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,17 +1,13 @@ -Yii 2.0 Unit tests -================== +# Yii 2.0 Unit tests -DIRECTORY STRUCTURE -------------------- +## DIRECTORY STRUCTURE data/ models, config and other test data config.php this file contains configuration for database and caching backends framework/ the framework unit tests runtime/ the application runtime dir for the yii test app - -HOW TO RUN THE TESTS --------------------- +## HOW TO RUN THE TESTS Make sure you have PHPUnit installed and that you installed all composer dependencies (run `composer update` in the repo base directory). @@ -35,8 +31,7 @@ A single test class could be run like the following: phpunit tests/framework/base/ObjectTest.php ``` -TEST CONFIGURATION ------------------- +## TEST CONFIGURATION PHPUnit configuration is in `phpunit.xml.dist` in repository root folder. You can create your own phpunit.xml to override dist config. @@ -54,118 +49,39 @@ $config['databases']['mysql']['username'] = 'yiitest'; $config['databases']['mysql']['password'] = 'changeme'; ``` - -DOCKERIZED TESTING ------------------- +## DOCKERIZED TESTING Get started by going to the `tests` directory and copy the environment configuration. - cd tests - cp .env-dist .env +```bash +cd tests +cp .env-dist .env +``` -The newly created `.env` file defines the configuration files used by `docker-compose`. By default MySQL, Postgres and Caching services are enabled. +The newly created `.env` file defines the configuration files used by `docker-compose`. By default MySQL, Postgres etc. services are disabled. -> You can choose services available for testing by merging `docker-compose.[...].yml` files in `.env`. For example, if you only want to test with MySQL, you can modify the `COMPOSE_FILE` variable as follows +> You can choose services available for testing by merging `docker-compose.[...].yml` files in `.env`. For example, if you only want to test with MySQL, you can modify the `COMPOSE_FILE` variable as follows: -> COMPOSE_FILE=docker-compose.yml:docker-compose.mysql.yml +```env +COMPOSE_FILE=docker-compose.yml:docker-compose.mysql.yml +``` -When starting the stack now, you get containers for databases and caching servers to test with. +> Note: The files `docker-compose.caching.yml` and `docker-compose.mssql.yml` cannot be merged with `docker-compose.yml`. - docker-compose up -d +### Running tests via shell script -After all services have been initialized and the stack is fully up and running enter the PHP container - - docker-compose exec php bash +You need to go to the `tests` directory and run the `test-local.sh` script. The first argument can be: `default`, `caching`, `mssql`, `pgsql`, `mysql`. You can pass additional arguments to this script to control the behavior of PHPUnit. For example: -Run a group of unit tests - - $ vendor/bin/phpunit -v --group base --debug +```bash +cd tests +sh test-local.sh default --exclude caching,db +``` -#### Examples for running phpunit in a separate container - - docker-compose run php vendor/bin/phpunit -v --group caching,db - docker-compose run php vendor/bin/phpunit -v --exclude base,caching,db,i18n,log,mutex,rbac,validators,web - docker-compose run php vendor/bin/phpunit -v --exclude mssql,oci,wincache,cubrid +### Manually running the tests -> Note: Documentation about [installing additional extensions](https://github.com/yiisoft/yii2-docker/blob/master/docs/install-extensions.md) can be found at `yiisoft/yii2-docker`. +You can also run tests manually. To do this, you need to start the container and run the tests. For example: -### Cubrid - -> Note: Images for testing Cubrid are based on PHP 5, due to incompatibilities with PHP 7 - - cd tests/cubrid - docker-compose up -d - docker-compose run php vendor/bin/phpunit -v --group cubrid - -### MSSQL - -> Note: Images for testing MSSQL are based on `bylexus/apache-php7` (Ubuntu) since drivers are not available for Debian or Alpine. - -**experimental** - -- needs 3.5 GB RAM, Docker-host with >4.5 GB is recommended for testing -- database CLI `tsgkadot/mssql-tools` - -Example commands - - cd tests/mssql - -Using a shell - - docker-compose run --rm sqlcmd sqlcmd -S mssql -U sa -P Microsoft-12345 - -Create database with sqlcmd - - $ sqlcmd -S mssql -U sa -P Microsoft-12345 -Q "CREATE DATABASE yii2test" - -Create database (one-liner) - - docker-compose run --rm sqlcmd sqlcmd -S mssql -U sa -P Microsoft-12345 -Q "CREATE DATABASE yii2test" - -Run MSSQL tests - - docker-compose run php - $ vendor/bin/phpunit --group mssql - -### Build triggers - - curl -X POST \ - -F token=${TOKEN} \ - -F ref=travis \ - -F "variables[DOCKER_MYSQL_IMAGE]=mysql:5.6" \ - -F "variables[DOCKER_POSTGRES_IMAGE]=postgres:9.5" \ - ${TRIGGER_URL} - -### Run tests locally - -#### Via shell script - - cd tests - sh test-local.sh default - -#### Via runner - -*experimental* - -docker-compose configuration - - runner: - image: schmunk42/gitlab-runner - entrypoint: bash - working_dir: /project - volumes: - - ../:/project - - /var/run/docker.sock:/var/run/docker.sock - environment: - - RUNNER_BUILDS_DIR=${PWD}/.. - -Start runner bash - - docker-compose -f docker-compose.runner.yml run runner - -Execute jobs via shell runner (with docker-compose support) - - $ gitlab-runner exec shell build - $ gitlab-runner exec shell test - - +```bash +docker compose up -d +docker compose exec php vendor/bin/phpunit -v +``` diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 35a3b1e4a9..dd94b577b9 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -23,9 +23,9 @@ require_once __DIR__ . '/../framework/Yii.php'; Yii::setAlias('@yiiunit', __DIR__); -if (getenv('TEST_RUNTIME_PATH')) { - Yii::setAlias('@yiiunit/runtime', getenv('TEST_RUNTIME_PATH')); - Yii::setAlias('@runtime', getenv('TEST_RUNTIME_PATH')); +if (getenv('IS_LOCAL_TESTS')) { + Yii::setAlias('@yiiunit/runtime', '/tmp/runtime'); + Yii::setAlias('@runtime', '/tmp/runtime'); } require_once __DIR__ . '/TestCase.php'; diff --git a/tests/cubrid/Dockerfile b/tests/cubrid/Dockerfile deleted file mode 100644 index 6d3de1af4a..0000000000 --- a/tests/cubrid/Dockerfile +++ /dev/null @@ -1,31 +0,0 @@ -FROM php:5-fpm - -# /usr/local/lib/php/extensions/no-debug-non-zts-20131226/cubrid.so -RUN pecl install pdo_cubrid-9.3.0.0001 -RUN echo "extension=pdo_cubrid.so" > /usr/local/etc/php/conf.d/cubrid.ini - - -# Install system packages for composer (git) -RUN apt-get update && \ - apt-get -y install \ - git \ - --no-install-recommends && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -# Register the COMPOSER_HOME environment variable -ENV COMPOSER_HOME /composer -# Add global binary directory to PATH and make sure to re-export it -ENV PATH /usr/local/bin:$PATH -# Allow Composer to be run as root -ENV COMPOSER_ALLOW_SUPERUSER 1 -# Install composer -RUN curl -sS https://getcomposer.org/installer | php -- \ - --filename=composer.phar \ - --install-dir=/usr/local/bin - - -# Project source-code -WORKDIR /project -ADD composer.* /project/ -RUN /usr/local/bin/composer.phar install --prefer-dist -ADD ./ /project diff --git a/tests/cubrid/docker-compose.yml b/tests/cubrid/docker-compose.yml deleted file mode 100644 index 8085334167..0000000000 --- a/tests/cubrid/docker-compose.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: '2' -services: - - php: - build: - context: ../.. - dockerfile: tests/cubrid/Dockerfile - ports: - - 80 - #volumes: - # - ../..:/project - depends_on: - - cubrid - - cubrid: - image: lighthopper/cubrid:9.3.6.0002 - command: ./create-start-demodb.sh \ No newline at end of file diff --git a/tests/data/config-docker.php b/tests/data/config-docker.php index 7d6af7bcb1..b3e0577702 100644 --- a/tests/data/config-docker.php +++ b/tests/data/config-docker.php @@ -30,7 +30,7 @@ $config = [ 'mysql' => [ 'dsn' => 'mysql:host=mysql;dbname=yiitest', 'username' => 'root', - 'password' => 'secret', + 'password' => 'root', 'fixture' => __DIR__ . '/mysql.sql', ], 'sqlite' => [ @@ -38,9 +38,9 @@ $config = [ 'fixture' => __DIR__ . '/sqlite.sql', ], 'sqlsrv' => [ - 'dsn' => 'sqlsrv:Server=mssql;Database=yii2test', - 'username' => 'sa', - 'password' => 'Microsoft-12345', + 'dsn' => 'sqlsrv:Server=mssql;Database=yiitest;TrustServerCertificate=true;', + 'username' => 'SA', + 'password' => 'YourStrong!Passw0rd', 'fixture' => __DIR__ . '/mssql.sql', ], 'pgsql' => [ diff --git a/tests/docker-compose.caching.yml b/tests/docker-compose.caching.yml index ecbad3e96e..b3d38a23f0 100644 --- a/tests/docker-compose.caching.yml +++ b/tests/docker-compose.caching.yml @@ -1,13 +1,22 @@ -version: '2' services: - php: + build: + context: .. + dockerfile: tests/Dockerfile.caching + ports: + - 80 + volumes: + - ../tests/data/config-docker.php:/project/tests/data/config.php + environment: + IS_LOCAL_TESTS: 1 depends_on: - - redis - - memcached - - redis: - image: redis + memcached: + condition: service_healthy memcached: - image: memcached + image: ${DOCKER_MEMCACHED_IMAGE} + healthcheck: + test: ["CMD", "timeout", "5", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/11211"] + interval: 10s + timeout: 5s + retries: 5 diff --git a/tests/docker-compose.mssql.yml b/tests/docker-compose.mssql.yml new file mode 100644 index 0000000000..d462da17b8 --- /dev/null +++ b/tests/docker-compose.mssql.yml @@ -0,0 +1,39 @@ +services: + php: + build: + context: .. + dockerfile: tests/Dockerfile.mssql + ports: + - 80 + volumes: + - ../tests/data/config-docker.php:/project/tests/data/config.php + environment: + IS_LOCAL_TESTS: 1 + depends_on: + mssql: + condition: service_healthy + + mssql: + image: mcr.microsoft.com/mssql/server:2022-latest + environment: + SA_PASSWORD: YourStrong!Passw0rd + ACCEPT_EULA: Y + MSSQL_PID: Developer + healthcheck: + test: + [ + "CMD", + "/opt/mssql-tools18/bin/sqlcmd", + "-C", + "-S", + "localhost", + "-U", + "SA", + "-P", + "YourStrong!Passw0rd", + "-Q", + "'SELECT 1'", + ] + interval: 10s + timeout: 3s + retries: 5 diff --git a/tests/docker-compose.mysql.yml b/tests/docker-compose.mysql.yml index 3ae739848e..f4f283fdb8 100644 --- a/tests/docker-compose.mysql.yml +++ b/tests/docker-compose.mysql.yml @@ -1,15 +1,16 @@ -version: '2' services: - php: depends_on: - - mysql + mysql: + condition: service_healthy mysql: image: ${DOCKER_MYSQL_IMAGE} environment: - - MYSQL_ROOT_PASSWORD=secret - - MYSQL_DATABASE=yiitest - - MYSQL_USER=travis - - MYSQL_PASSWORD=travis - + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: yiitest + healthcheck: + test: ["CMD", "mysql", "-uroot", "-proot", "-e", "SELECT 1"] + interval: 10s + timeout: 3s + retries: 5 diff --git a/tests/docker-compose.pgsql.yml b/tests/docker-compose.pgsql.yml index 34c481ba26..59d8c526b5 100644 --- a/tests/docker-compose.pgsql.yml +++ b/tests/docker-compose.pgsql.yml @@ -1,14 +1,17 @@ -version: '2' - services: - php: depends_on: - - postgres + postgres: + condition: service_healthy postgres: image: ${DOCKER_POSTGRES_IMAGE} environment: - - POSTGRES_DB=yiitest - - POSTGRES_USER=postgres - - POSTGRES_PASSWORD=postgres \ No newline at end of file + POSTGRES_DB: yiitest + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + healthcheck: + test: ["CMD", "pg_isready"] + interval: 10s + timeout: 3s + retries: 5 diff --git a/tests/docker-compose.yml b/tests/docker-compose.yml index 13d86eb3df..64b270fc4b 100644 --- a/tests/docker-compose.yml +++ b/tests/docker-compose.yml @@ -1,6 +1,4 @@ -version: '2' services: - php: build: context: .. @@ -9,11 +7,5 @@ services: working_dir: /project volumes: - ../tests/data/config-docker.php:/project/tests/data/config.php - # Enable for debugging, enabling tests might be slow for file access (data) on host-volume - - ../tests:/project/tests - - ../framework:/project/framework - # Tmpfs volume (experimental, asset tests may fail) - #tmpfs: - # - /project/tests/runtime environment: - - TEST_RUNTIME_PATH=/tmp/runtime + IS_LOCAL_TESTS: 1 diff --git a/tests/framework/caching/MemCachedTest.php b/tests/framework/caching/MemCachedTest.php index d05e149d03..4a20217bc6 100644 --- a/tests/framework/caching/MemCachedTest.php +++ b/tests/framework/caching/MemCachedTest.php @@ -36,13 +36,23 @@ class MemCachedTest extends CacheTestCase $this->markTestSkipped("memcached version $memcached_version is not ready for PHP $php_version. Skipping."); } + $memcachedHost = getenv('IS_LOCAL_TESTS') ? 'memcached' : '127.0.0.1'; + // check whether memcached is running and skip tests if not. - if (!@stream_socket_client('127.0.0.1:11211', $errorNumber, $errorDescription, 0.5)) { - $this->markTestSkipped('No memcached server running at ' . '127.0.0.1:11211' . ' : ' . $errorNumber . ' - ' . $errorDescription); + if (!@stream_socket_client("$memcachedHost:11211", $errorNumber, $errorDescription, 0.5)) { + $this->markTestSkipped('No memcached server running at ' . "$memcachedHost:11211" . ' : ' . $errorNumber . ' - ' . $errorDescription); } if ($this->_cacheInstance === null) { - $this->_cacheInstance = new MemCache(['useMemcached' => true]); + $this->_cacheInstance = new MemCache([ + 'useMemcached' => true, + 'servers' => [ + [ + 'host' => $memcachedHost, + 'port' => 11211, + ], + ], + ]); } return $this->_cacheInstance; diff --git a/tests/mssql/Dockerfile b/tests/mssql/Dockerfile deleted file mode 100644 index 5f0a223e12..0000000000 --- a/tests/mssql/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -FROM bylexus/apache-php7 - - -# https://www.microsoft.com/en-us/sql-server/developer-get-started/php-ubuntu -RUN apt-get update -RUN apt-get install -y curl apt-transport-https - -RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - -RUN curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list - -RUN apt-get update \ - && apt-get install -y unixodbc-dev-utf16 php-dev \ - && pecl install sqlsrv pdo_sqlsrv - -RUN echo ";priority=20\nextension=sqlsrv.so" > /etc/php/7.0/cli/conf.d/20-sqlsrv.ini -RUN echo ";priority=20\nextension=sqlsrv.so" > /etc/php/7.0/apache2/conf.d/20-sqlsrv.ini -RUN echo ";priority=30\nextension=pdo_sqlsrv.so" > /etc/php/7.0/cli/conf.d/30-pdo_sqlsrv.ini -RUN echo ";priority=30\nextension=pdo_sqlsrv.so" > /etc/php/7.0/apache2/conf.d/30-pdo_sqlsrv.ini - -# IMPORTANT NOTICE! Install `msodbcsql` after `unixodbc-dev-utf16` and `pdo_sqlsrv`, due to dependency & build issues -RUN ACCEPT_EULA=Y apt-get install -y msodbcsql - -# Install system packages for composer (git) -RUN apt-get update && \ - apt-get -y install \ - git \ - php-curl \ - --no-install-recommends && \ - rm -rf /tmp/* /var/tmp/* -# Register the COMPOSER_HOME environment variable -ENV COMPOSER_HOME /composer -# Add global binary directory to PATH and make sure to re-export it -ENV PATH /usr/local/bin:$PATH -# Allow Composer to be run as root -ENV COMPOSER_ALLOW_SUPERUSER 1 -# Install composer -RUN curl -sS https://getcomposer.org/installer | php -- \ - --filename=composer.phar \ - --install-dir=/usr/local/bin -RUN composer.phar global require --optimize-autoloader \ - "hirak/prestissimo" - - -# Project source-code -WORKDIR /project -ADD composer.* /project/ -RUN /usr/local/bin/composer.phar install --prefer-dist -ADD ./ /project - -# https://github.com/Microsoft/msphpsql/issues/161 -RUN apt-get install -y locales \ - && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \ - && locale-gen - -# Debug installation -RUN dpkg -L msodbcsql diff --git a/tests/mssql/docker-compose.yml b/tests/mssql/docker-compose.yml deleted file mode 100644 index 69bc2f4d34..0000000000 --- a/tests/mssql/docker-compose.yml +++ /dev/null @@ -1,36 +0,0 @@ -version: '2' -services: - - php: - build: - context: ../.. - dockerfile: tests/mssql/Dockerfile - # Alternative pre-built image (TODO: evaluate) - #image: ppoffice/apache-php-mssql-odbc - ports: - - 80 - # Enable for debugging, Note: File-cache tests may be VERY slow or fail - #volumes: - # - ../../..:/project - volumes: - - ../../tests/data/config-docker.php:/project/tests/data/config.php - depends_on: - - mssql - # Enable for debugging - #entrypoint: ['bash'] - - mssql: - image: microsoft/mssql-server-linux - # Alternative pre-built image (TODO: evaluate) - #image: microsoft/mssql-server-windows - environment: - - ACCEPT_EULA=Y - - SA_PASSWORD=Microsoft-12345 - - sqlcmd: - image: tsgkadot/mssql-tools - # Mount project for accessing SQL dump (TODO) - volumes: - - ../..:/project - # Enable for debugging - #entrypoint: ['bash'] diff --git a/tests/test-local.sh b/tests/test-local.sh index 9b286fbd5c..848bbfed4c 100644 --- a/tests/test-local.sh +++ b/tests/test-local.sh @@ -1,55 +1,49 @@ #!/usr/bin/env bash -# Generate a "hash" from 0-99 for subnet tuple (10, 11, ..., 199) - it's a hack -echo "Creating CI_BUILD_ID and CI_PIPELINE_ID from first argument..." -export CI_BUILD_ID=$(expr $((32#${1})) % 99) -export CI_PIPELINE_ID=${1} - -# Copy snippets from https://git.hrzg.de/ci/lint +# TODO: add mariadb, sqlite and oracle case $1 in 'default') - export ISOLATION=buildpipeline${CI_PIPELINE_ID} - export COMPOSE_PROJECT_NAME=${ISOLATION}default - docker-compose up -d - docker-compose run --rm php vendor/bin/phpunit -v --exclude caching,db - docker-compose down -v + shift + docker compose up -d + docker compose run --rm php vendor/bin/phpunit -v $@ + docker compose down -v ;; 'caching') - export ISOLATION=buildpipeline${CI_PIPELINE_ID} - export COMPOSE_PROJECT_NAME=${ISOLATION}caching - docker-compose up -d - docker-compose run --rm php bash -c "while ! curl mysql:3306; do ((c++)) && ((c==30)) && break; sleep 2; done" - docker-compose run --rm php vendor/bin/phpunit -v --group caching - docker-compose down -v + export COMPOSE_FILE=docker-compose.caching.yml + export COMPOSE_PROJECT_NAME=yii2tests-default + shift + docker compose up --build -d + docker compose run --rm php vendor/bin/phpunit -v --group caching --exclude-group db $@ + docker compose down -v --remove-orphans ;; 'mssql') - export ISOLATION=buildpipeline${CI_PIPELINE_ID} - export COMPOSE_PROJECT_NAME=${ISOLATION}mssql - cd mssql - docker-compose up --build -d - docker-compose run --rm php bash -c 'while [ true ]; do curl mssql:1433; if [ $? == 52 ]; then break; fi; ((c++)) && ((c==15)) && break; sleep 5; done' - sleep 10 - docker-compose run --rm sqlcmd sh -c 'sqlcmd -S mssql -U sa -Q "CREATE DATABASE yii2test" -P Microsoft-12345' - sleep 10 - docker-compose logs mssql - docker-compose config - pwd - docker-compose ps - docker-compose run --rm php php -i - docker-compose run --rm php vendor/bin/phpunit -v --group mssql - docker-compose down -v --remove-orphans + export COMPOSE_FILE=docker-compose.mssql.yml + export COMPOSE_PROJECT_NAME=yii2tests-mssql + shift + docker compose up --build -d + docker compose run --rm mssql /opt/mssql-tools18/bin/sqlcmd -C -S mssql -U SA -P YourStrong!Passw0rd -Q "CREATE DATABASE yiitest" + docker compose run --rm php vendor/bin/phpunit -v --group mssql $@ + docker compose down -v --remove-orphans ;; 'pgsql') - export ISOLATION=buildpipeline${CI_PIPELINE_ID} - export COMPOSE_PROJECT_NAME=${ISOLATION}pgsql - docker-compose up -d - docker-compose run --rm php bash -c 'while [ true ]; do curl postgres:5432; if [ $? == 52 ]; then break; fi; ((c++)) && ((c==25)) && break; sleep 2; done' - docker-compose run --rm php vendor/bin/phpunit -v --group pgsql - docker-compose down -v + export COMPOSE_FILE=docker-compose.yml:docker-compose.pgsql.yml + export COMPOSE_PROJECT_NAME=yii2tests-pgsql + shift + docker compose up -d + docker compose run --rm php vendor/bin/phpunit -v --group pgsql $@ + docker compose down -v + ;; +'mysql') + export COMPOSE_FILE=docker-compose.yml:docker-compose.mysql.yml + export COMPOSE_PROJECT_NAME=yii2tests-mysql + shift + docker compose up -d + docker compose run --rm php vendor/bin/phpunit -v --group mysql $@ + docker compose down -v ;; *) echo "Warning: No job argument specified" ;; esac -echo "Done." \ No newline at end of file +echo "Done."