dkan-tools
dkan-tools copied to clipboard
Add command for running project-specitic PHPUnit tests
User Story:
When I write custom code for DKAN site, I want to be able to test it, to ensure against regression.
Acceptance Criteria:
I can run dktl site:test:phpunit dktl site:test:cypress and the tests located in src directory will be run
Create commands above that will run corresponding tests
Estimate:
1 day
Notes:
phpunit.xml
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.6/phpunit.xsd"
bootstrap="/var/www/vendor/weitzman/drupal-test-traits/src/bootstrap.php"
colors="true"
stopOnFailure="false"
stopOnError="false"
verbose="true">
<testsuites>
<testsuite name="Custom Test Suite">
<directory>my_module/tests/src/ExistingSite/TestName.php</directory>
</testsuite>
</testsuites>
<php>
<!-- These variables may alternatively be set as environment variables. -->
<!-- E.g., `DRUPAL_VERSION=V8 ./vendor/bin/phpunit` -->
<env name="DRUPAL_VERSION" value="V8"/>
<env name="DTT_BASE_URL" value="http://web"/>
<env name="SIMPLETEST_BASE_URL" value="http://web"/>
<env name="SIMPLETEST_DB" value="mysql://drupal:123@db/drupal"/>
</php>
</phpunit>
- Add
phpunit.xml
tosrc/modules
- Run
dktl custom:test-phpunit --testsuite "Custom Test Suite"
Also, there should really be tests for these... let's discuss we can make a separate ticket for those if not feasible for this PR.