From 4411c363ae4bd69a0fdd9b4bf7e85dfb53822520 Mon Sep 17 00:00:00 2001 From: Finn Lewis Date: Fri, 10 May 2024 16:31:26 +0200 Subject: [PATCH 1/4] Update DDEV config to add fqdns for localgov_microsites_group phpunit tests. --- .ddev/config.yaml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.ddev/config.yaml b/.ddev/config.yaml index ccc2e11..156723a 100644 --- a/.ddev/config.yaml +++ b/.ddev/config.yaml @@ -6,15 +6,20 @@ webserver_type: nginx-fpm router_http_port: "80" router_https_port: "443" xdebug_enabled: false -additional_hostnames: [ - localgov-micro, - localgov-micro-1, - localgov-micro-2, - localgov-micro-3, - localgov-micro-4, - localgov-micro-5 -] -additional_fqdns: [] +additional_hostnames: + - localgov-micro, + - localgov-micro-1 + - localgov-micro-2 + - localgov-micro-3 + - localgov-micro-4 + - localgov-micro-5 +additional_fqdns: + - group-0.web + - group-1.web + - group-2.web + - group-3.web + - group-4.web + - group-5.web database: type: mariadb version: "10.3" From 4601c7c7b17d64d075d01e471304fb1215944731 Mon Sep 17 00:00:00 2001 From: Finn Lewis Date: Fri, 10 May 2024 16:32:21 +0200 Subject: [PATCH 2/4] Remove wrogue comma. --- .ddev/config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ddev/config.yaml b/.ddev/config.yaml index 156723a..579a500 100644 --- a/.ddev/config.yaml +++ b/.ddev/config.yaml @@ -7,7 +7,7 @@ router_http_port: "80" router_https_port: "443" xdebug_enabled: false additional_hostnames: - - localgov-micro, + - localgov-micro - localgov-micro-1 - localgov-micro-2 - localgov-micro-3 @@ -19,7 +19,7 @@ additional_fqdns: - group-2.web - group-3.web - group-4.web - - group-5.web + - group-5.we database: type: mariadb version: "10.3" From 0667d0e3461f70bd03c659b53d801847f922ce02 Mon Sep 17 00:00:00 2001 From: Finn Lewis Date: Fri, 10 May 2024 16:44:10 +0200 Subject: [PATCH 3/4] Add ddev phpunit guidance to REAME.md. --- README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a469c16..b39dac1 100644 --- a/README.md +++ b/README.md @@ -72,10 +72,58 @@ lando ssh phpunit --filter=myTestName ``` + +## Running PHPUnit tests in DDEV + +The included phpunit.xml.dist file contains configuration for automatically +running the LocalGov Drupal test suite. + +The default .ddev/config.yml includes configuration for some extra domains that +ddev and phpunit will need to resolve different microsite domains. + +When ddev starts, it will attempt to write these to /etc/hosts + +If DDEV cannot write to /etc/hosts, you may need to add these manually. + +If you are having problems runnign phpunit tests in DDEV, try adding the +following to `/etc/hosts` + +``` +127.0.0.1 group-1.web group-2.web group-3.web group-4.web group-5.web +``` + +To allow html output, manually create a directory for browser output. + +```bash +mkdir web/sites/simpletest/browser_output +``` + +To run all LocalGov Drupal tests from inside DDEV: + +```bash +ddev ssh +phpunit +``` + +To run all the tests for a specific module: + +```bash +ddev ssh +phpunit web/modules/contrib/localgov_my_module +``` + +Tests can be filtered using the `--filter` option. To only run a specific test: + +```bash +ddev ssh +phpunit --filter=myTestName +``` + + ## Maintainers -This project is currently maintained by: +This project is currently maintained by: - Ekes: https://www.drupal.org/u/ekes - Finn Lewis: https://www.drupal.org/u/finn-lewis - - Stephen Cox: https://www.drupal.org/u/stephen-cox + - Stephen Cox: https://www.drupal.org/u/stephen-cox From ec0468dbd049c5113fc4f1e4cf7bfe616f09e4b5 Mon Sep 17 00:00:00 2001 From: ekes Date: Tue, 21 May 2024 12:42:00 +0200 Subject: [PATCH 4/4] Correct last fqdns typo. --- .ddev/config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ddev/config.yaml b/.ddev/config.yaml index 579a500..9044479 100644 --- a/.ddev/config.yaml +++ b/.ddev/config.yaml @@ -19,7 +19,7 @@ additional_fqdns: - group-2.web - group-3.web - group-4.web - - group-5.we + - group-5.web database: type: mariadb version: "10.3"