From 5f62b02d14e6a253816dd5be94247ce83ea429cd Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sun, 18 Feb 2024 16:35:37 +0000 Subject: [PATCH] Make the PHP test runner conifigurable PHPUnit, Pest or Paratest. --- resources/build.defaults.yaml | 3 +++ src/DataTransferObject/ConfigDto.php | 4 ++++ templates/drupal/run.twig | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/build.defaults.yaml b/resources/build.defaults.yaml index dc1f09e..a0749ab 100644 --- a/resources/build.defaults.yaml +++ b/resources/build.defaults.yaml @@ -1,6 +1,9 @@ drupal: docroot: web +php: + test_runner: phpunit + experimental: runStaticAnalysisOnTests: false useNewDatabaseCredentials: true diff --git a/src/DataTransferObject/ConfigDto.php b/src/DataTransferObject/ConfigDto.php index b2d7d73..2384ee4 100644 --- a/src/DataTransferObject/ConfigDto.php +++ b/src/DataTransferObject/ConfigDto.php @@ -240,6 +240,10 @@ final class ConfigDto 'phpunit' => new Assert\Optional( new Assert\IsFalse(), ), + + 'test_runner' => new Assert\Optional( + new Assert\Choice(['phpunit', 'pest', 'paratest']), + ), ], )] public array $php; diff --git a/templates/drupal/run.twig b/templates/drupal/run.twig index d69cc0c..6e58a02 100755 --- a/templates/drupal/run.twig +++ b/templates/drupal/run.twig @@ -111,9 +111,9 @@ function stop { docker compose down } -{% if not php.phpunit is same as false %} +{% if not php.phpunit is same as false and not php.test_runner is same as false %} function test { - _exec php phpunit --colors=always "${@}" + _exec php {{ php.test_runner }} --colors=always "${@}" } {% endif %}