From 16c52f4fbc7a95e6639fc8609e41997f0ac4b7c1 Mon Sep 17 00:00:00 2001 From: Patchy Date: Wed, 8 May 2024 08:36:40 +1000 Subject: [PATCH 1/5] Set PHPUnit env vars in docker instead of phpunit.xml --- .env.dist | 4 ++-- docker-compose.yml | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.env.dist b/.env.dist index b8ca3ae..58e75b0 100644 --- a/.env.dist +++ b/.env.dist @@ -8,8 +8,8 @@ UID=1000 GID=1000 # CHROME DRIVER -# SELENIUM_IMAGE=drupalci/chromedriver:production -# MINK_DRIVER_ARGS_WEBDRIVER='["chrome", {"browserName":"chrome","goog:chromeOptions":{"args":["--headless", "--disable-gpu", "--no-sandbox", "--disable-dev-shm-usage"]}}, "http://127.0.0.1:9515"]' +SELENIUM_IMAGE=drupalci/chromedriver:production +MINK_DRIVER_ARGS_WEBDRIVER='["chrome", {"browserName":"chrome","goog:chromeOptions":{"args":["--headless", "--disable-gpu", "--no-sandbox", "--disable-dev-shm-usage"]}}, "http://127.0.0.1:9515"]' ## SELENIUM CHROME # SELENIUM_IMAGE=selenium/standalone-chrome:111.0 diff --git a/docker-compose.yml b/docker-compose.yml index beb4bc7..88ee237 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -41,9 +41,12 @@ services: network_mode: service:nginx environment: - DRUSH_OPTIONS_URI=${BASE_URI:-http://127.0.0.1:8080} + - PHP_IDE_CONFIG=serverName=localhost + - SIMPLETEST_BASE_URL=${SIMPLETEST_BASE_URL:-http://127.0.0.1:8080} + - SIMPLETEST_DB=${SIMPLETEST_DB:-mysql://local:local@127.0.0.1/local} + - BROWSERTEST_OUTPUT_DIRECTORY=${BROWSERTEST_OUTPUT_DIRECTORY:-/tmp} - BROWSERTEST_OUTPUT_BASE_URL=${BASE_URI:-http://127.0.0.1:8080} - MINK_DRIVER_ARGS_WEBDRIVER - - PHP_IDE_CONFIG=serverName=localhost volumes: - ./:/data - ./.docker/php/custom.ini:/etc/php/conf.d/99-custom.ini From 2600c97e826595b984053d77cedd3863af70819d Mon Sep 17 00:00:00 2001 From: Patchy Date: Wed, 8 May 2024 08:37:14 +1000 Subject: [PATCH 2/5] Remove phpunit.xml and update phpstorm config to use phpunit.xml.dist from core --- assets/scaffold/files/php.xml | 2 +- phpunit.xml | 62 ----------------------------------- 2 files changed, 1 insertion(+), 63 deletions(-) delete mode 100644 phpunit.xml diff --git a/assets/scaffold/files/php.xml b/assets/scaffold/files/php.xml index e53ff53..368bcb9 100644 --- a/assets/scaffold/files/php.xml +++ b/assets/scaffold/files/php.xml @@ -15,7 +15,7 @@ - + diff --git a/phpunit.xml b/phpunit.xml deleted file mode 100644 index 9b60293..0000000 --- a/phpunit.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - ./app/core/tests/TestSuites/UnitTestSuite.php - - - ./app/core/tests/TestSuites/KernelTestSuite.php - - - ./app/core/tests/TestSuites/FunctionalTestSuite.php - - - ./app/core/tests/TestSuites/FunctionalJavascriptTestSuite.php - - - ./app/core/tests/TestSuites/BuildTestSuite.php - - - - - - - - - - ./app/core/includes - ./app/core/lib - ./app/core/modules - ./app/modules - ./app/core/sites - - - ./app/core/modules/*/src/Tests - ./app/core/modules/*/tests - ./app/core/modules/*/src/Tests - ./app/core/modules/*/tests - ./app/core/modules/*/*/src/Tests - ./app/core/modules/*/*/tests - - - From 9a44a77e8cef49ca7b1b750696d2ba7dc1546c27 Mon Sep 17 00:00:00 2001 From: Patchy Date: Wed, 8 May 2024 08:37:37 +1000 Subject: [PATCH 3/5] Update README to include core phpunit config --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dc18bd5..22ac514 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ Alternatively you can run phpunit on the command line like so: ``` docker-compose exec php-cli bash -phpunit app/core/tests/Drupal/Tests/Core/DrupalKernel/ +phpunit -c app/core/phpunit.xml.dist app/core/tests/Drupal/Tests/Core/DrupalKernel/ ``` ## Debugging From 091de885253e2c42cf51da8572dd503fea866673 Mon Sep 17 00:00:00 2001 From: Patchy Date: Wed, 8 May 2024 09:04:38 +1000 Subject: [PATCH 4/5] BROWSERTEST_OUTPUT_VERBOSE=true --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 88ee237..cc97772 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -46,6 +46,7 @@ services: - SIMPLETEST_DB=${SIMPLETEST_DB:-mysql://local:local@127.0.0.1/local} - BROWSERTEST_OUTPUT_DIRECTORY=${BROWSERTEST_OUTPUT_DIRECTORY:-/tmp} - BROWSERTEST_OUTPUT_BASE_URL=${BASE_URI:-http://127.0.0.1:8080} + - BROWSERTEST_OUTPUT_VERBOSE=${BROWSERTEST_OUTPUT_VERBOSE:-true} - MINK_DRIVER_ARGS_WEBDRIVER volumes: - ./:/data From 0d39ccb3ea16145116ee47b1aa13c4965462f31f Mon Sep 17 00:00:00 2001 From: Patchy Date: Wed, 8 May 2024 09:08:28 +1000 Subject: [PATCH 5/5] Add env vars to dist --- .env.dist | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.env.dist b/.env.dist index 58e75b0..ff63541 100644 --- a/.env.dist +++ b/.env.dist @@ -7,6 +7,13 @@ BASE_URI=http://127.0.0.1:8080 UID=1000 GID=1000 +# PHPUnit +SIMPLETEST_BASE_URL=http://127.0.0.1:8080 +SIMPLETEST_DB=mysql://local:local@127.0.0.1/local +BROWSERTEST_OUTPUT_DIRECTORY=/tmp +BROWSERTEST_OUTPUT_BASE_URL=${BASE_URI} +BROWSERTEST_OUTPUT_VERBOSE=true + # CHROME DRIVER SELENIUM_IMAGE=drupalci/chromedriver:production MINK_DRIVER_ARGS_WEBDRIVER='["chrome", {"browserName":"chrome","goog:chromeOptions":{"args":["--headless", "--disable-gpu", "--no-sandbox", "--disable-dev-shm-usage"]}}, "http://127.0.0.1:9515"]'