diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6eb5e22..f8ba225 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,6 @@ name: CI on: - push: pull_request: env: diff --git a/Makefile b/Makefile index fcb2e47..49b4436 100644 --- a/Makefile +++ b/Makefile @@ -1,28 +1,29 @@ +PHP_IMAGE = gustavofreze/php:8.3 DOCKER_RUN = docker run -u root --rm -it --network=tiny-blocks --name test-lib \ -v ${PWD}:/app \ -v ${PWD}/tests/Integration/Database/Migrations:/test-adm-migrations \ -v /var/run/docker.sock:/var/run/docker.sock \ - -w /app gustavofreze/php:8.3 + -w /app ${PHP_IMAGE} -.PHONY: configure test unit-test test-no-coverage create-volume create-network review show-reports clean +.PHONY: configure test unit-test test-no-coverage configure-test-environment review show-reports clean -configure: +configure: configure-test-environment @${DOCKER_RUN} composer update --optimize-autoloader -test: create-volume +test: configure-test-environment @${DOCKER_RUN} composer tests unit-test: @${DOCKER_RUN} composer run unit-test -test-no-coverage: create-volume +test-no-coverage: configure-test-environment @${DOCKER_RUN} composer tests-no-coverage -create-network: - @docker network create tiny-blocks - -create-volume: - @docker volume create test-adm-migrations +configure-test-environment: + @if ! docker network inspect tiny-blocks > /dev/null 2>&1; then \ + docker network create tiny-blocks > /dev/null 2>&1; \ + fi + @docker volume create test-adm-migrations > /dev/null 2>&1 review: @${DOCKER_RUN} composer review diff --git a/composer.json b/composer.json index 799f42a..fa2b34c 100644 --- a/composer.json +++ b/composer.json @@ -53,12 +53,12 @@ "ext-pdo": "*" }, "scripts": { + "test": "phpunit -d memory_limit=2G --configuration phpunit.xml tests", "phpcs": "phpcs --standard=PSR12 --extensions=php ./src", "phpmd": "phpmd ./src text phpmd.xml --suffixes php --ignore-violations-on-exit", "phpstan": "phpstan analyse -c phpstan.neon.dist --quiet --no-progress", - "test": "phpunit --log-junit=report/coverage/junit.xml --coverage-xml=report/coverage/coverage-xml --coverage-html=report/coverage/coverage-html tests", - "unit-test": "phpunit --no-coverage -c phpunit.xml --testsuite unit", - "test-no-coverage": "phpunit --no-coverage", + "unit-test": "phpunit --no-coverage --configuration phpunit.xml --testsuite unit", + "test-no-coverage": "phpunit --configuration phpunit.xml --no-coverage tests", "review": [ "@phpcs", "@phpmd", diff --git a/phpunit.xml b/phpunit.xml index d1590d1..d851f93 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -26,14 +26,15 @@ + + - - + diff --git a/src/Internal/Containers/Models/Address/Ports.php b/src/Internal/Containers/Models/Address/Ports.php index 1c0c787..72b3409 100644 --- a/src/Internal/Containers/Models/Address/Ports.php +++ b/src/Internal/Containers/Models/Address/Ports.php @@ -5,7 +5,7 @@ namespace TinyBlocks\DockerContainer\Internal\Containers\Models\Address; use TinyBlocks\Collection\Collection; -use TinyBlocks\Collection\Internal\Operations\Transform\PreserveKeys; +use TinyBlocks\Collection\PreserveKeys; use TinyBlocks\DockerContainer\Contracts\Ports as ContainerPorts; final readonly class Ports implements ContainerPorts diff --git a/tests/Integration/DockerContainerTest.php b/tests/Integration/DockerContainerTest.php index c1d4ba3..9ca415e 100644 --- a/tests/Integration/DockerContainerTest.php +++ b/tests/Integration/DockerContainerTest.php @@ -71,7 +71,7 @@ public function testMultipleContainersAreRunSuccessfully(): void /** @When the Flyway container runs the migration commands */ $flywayContainer = $flywayContainer->run( commands: ['-connectRetries=15', 'clean', 'migrate'], - waitAfterStarted: ContainerWaitForTime::forSeconds(seconds: 5) + waitAfterStarted: ContainerWaitForTime::forSeconds(seconds: 7) ); self::assertNotEmpty($flywayContainer->getName());