phpUnit Testing Tips - NCIOCPL/cgov-digital-platform GitHub Wiki
Running Tests
Run full test suite
$ blt test:phpunit
Run partial test suite
$ vi /var/www/blt/blt.yml
# Edit the phpunit.path setting to point to the file or folder containing the test(s) you want to run
Run single test
$ cd /var/www/docroot
$ ../vendor/bin/phpunit -c core profiles/custom/cgov_site/modules/custom/pdq_cancer_information_summary/tests/src/Functional/ApiTest.php
Debugging Tests
Undefined index: major
from Bryan:
I have encountered, infrequently, a condition in which the drupal installer works, and when it is done it downloads a
docroot/sites/default/files/translations/drupal-8.es.po
file upon a section reinstall, I see errors where the Major version is undefined, and that is because on the the bit that installs the translation pack for Spanish Drupal, looks at the .es.po files to suss out what version of drupal, or something like that. When it hits the odd ball 8.es.po, it fails.
$ rm /var/www/docroot/sites/default/files/translations/drupal-8.es.po
$ rm /var/www/docroot/sites/default/files/translations/drupal-8.x.es.po
# Then retest or `blt cgov:reinstall` and try again
Creating Tests
- Test classes must end in
Test