- Issue created by @joachim
- 🇪🇸Spain fjgarlin
Will that override just be the name of the file to run?
- 🇬🇧United Kingdom joachim
What I'd ideally like is for
> gitlab-ci-local phpunit path/to/folder-or-file
to behave the same way as on an OS:
> vendor/bin/phpunit path/to/folder-or-file
For that to work, the path/to/folder-or-file has to replace $DRUPAL_PROJECT_FOLDER, because that's the file parameter that phpunit gets.
- 🇪🇸Spain fjgarlin
What we could do is define a
_PHPUNIT_TEST_SINGLE_FILE
variable, which defaults to empty, then the call could be:
sudo -u www-data -H -E vendor/bin/phpunit $PHPUNIT_OPTIONS --bootstrap $PWD/$_WEB_ROOT/core/tests/bootstrap.php $DRUPAL_PROJECT_FOLDER$_PHPUNIT_TEST_SINGLE_FILE --log-junit $CI_PROJECT_DIR/junit.xml $WHAT_TO_RUN $_PHPUNIT_EXTRA || EXIT_CODE=$?
If somebody fills
_PHPUNIT_TEST_SINGLE_FILE
, it'll be something like/path/to/file.php
.Can the same be done for
run-tests.sh
? - 🇬🇧United Kingdom joachim
> Can the same be done for run-tests.sh?
I think if someone's running a single test locally, they won't be using the concurrency feature, so run-tests.sh wouldn't matter.
- 🇬🇧United Kingdom jonathan1055
We do have
$_PHPUNIT_TESTGROUPS
which filters on the @group defined in the test class.
See https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes...I know that many test classes could have the same group, but if you are debugging one file locally then just temporarily edit that test file to have a distinct value for the @group. This also has the benefit that is works for both
$_PHPUNIT_CONCURRENT:1
and$_PHPUNIT_CONCURRENT:0
- 🇪🇸Spain fjgarlin
I think it'd be a great idea to add the above information to https://project.pages.drupalcode.org/gitlab_templates/jobs/phpunit/
I think if someone's running a single test locally, they won't be using the concurrency feature, so run-tests.sh wouldn't matter.
It's not about the concurrency, it's about how they have configured their pipelines.
gitlab-ci-local phpunit
is running the GitLab "phpunit" CI job, not the binary. So if the project is configured to run withrun-tests.sh
, that's what will be used. It seems that a--file
parameter can be passed, so the suggestion on #4 could be on one part of theif/else
, and using this param should be on the other. - 🇬🇧United Kingdom jonathan1055
Re the first comment in #7, yes it is on my list of documentation updates to add
$_PHPUNIT_TESTGROUPS
to the phpunit page.