From 6ef9686b72a4c5293ef3e7b46d68eb09a99c19ec Mon Sep 17 00:00:00 2001 From: Michael Strelan Date: Wed, 8 May 2024 09:21:52 +1000 Subject: [PATCH] PHPUnit 10 support (#34) * Set PHPUnit env vars in docker instead of phpunit.xml * Remove phpunit.xml and update phpstorm config to use phpunit.xml.dist from core * Update README to include core phpunit config * BROWSERTEST_OUTPUT_VERBOSE=true * Add env vars to dist --- .env.dist | 11 +++++-- README.md | 2 +- assets/scaffold/files/php.xml | 2 +- docker-compose.yml | 6 +++- phpunit.xml | 62 ----------------------------------- 5 files changed, 16 insertions(+), 67 deletions(-) delete mode 100644 phpunit.xml diff --git a/.env.dist b/.env.dist index b8ca3ae..ff63541 100644 --- a/.env.dist +++ b/.env.dist @@ -7,9 +7,16 @@ 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"]' +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/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 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/docker-compose.yml b/docker-compose.yml index beb4bc7..cc97772 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -41,9 +41,13 @@ 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} + - BROWSERTEST_OUTPUT_VERBOSE=${BROWSERTEST_OUTPUT_VERBOSE:-true} - MINK_DRIVER_ARGS_WEBDRIVER - - PHP_IDE_CONFIG=serverName=localhost volumes: - ./:/data - ./.docker/php/custom.ini:/etc/php/conf.d/99-custom.ini 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 - - -