Unit tests
Last updated on
10 September 2020
Creating and running unit tests
To create the Open Social unit tests, these tests need to be placed in certain predefined directories.
These directories are added to the file: phpunit.xml.dist in the distribution.
If you look at:
html/profiles/contrib/social/phpunit.xml.distyou'll see we have several suites,
we run all the social tests from the following
<testsuite name="social">
<directory>modules/*/*/tests/src/Unit</directory>
<directory>modules/*/*/*/tests/src/Unit</directory>
<exclude>
<file>modules/contrib/address/tests/src/Unit/Plugin/Validation/Constraint/CountryConstraintValidatorTest.php</file>
</exclude>
</testsuite>so all tests written in features or custom modules within open social are tested.
Do you want to test something else? You can use the core-contrib or unit-core suite.
Running unit tests in Docker
To run the unit tests in a docker environment use the dev-scripts/unit_tests.sh script.
docker exec -it social_web bash /var/www/dev-scripts/unit-tests.sh
Help improve this page
Page status: No known problems
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion