-
Notifications
You must be signed in to change notification settings - Fork 95
Unit and integration tests
As part of the continuous integration workflow,
Skosmos codebase comes with a set of unit and integration tests under the tests/
directory that exercise most of the code and try to ensure that things keep working. The tests are executed in the GitHub Actions CI environment after every commit. See the ci.yml configuration for details on how the CI has been set up.
You need to install the development dependencies using Composer. Run composer install
without the --no-dev
parameter.
The unit tests need a Fuseki running in the background. Downloading and starting it has been automated.
The process differs a bit depending on whether you are using Skosmos 2 or the upcoming Skosmos 3 development version.
This requires rŔuby to be installed:
cd tests
. init_fuseki.sh
The Fuseki process will stay running until you kill it manually.
This requires that you have an up to date version of Docker tools installed, including docker compose
. Note that the Docker version available from the Ubuntu 22.04 repositories as the docker.io
package is too old. For documentation on how to install a more current Docker version from the official Docker repositories can be found in Docker documentation.
cd tests
./init_containers.sh
This starts up three containers (Fuseki, Skosmos and Varnish) via docker compose
. Only the Fuseki container is needed for PHPUnit tests, but Cypress tests need the other containers as well.
You can follow logs from the containers using docker compose logs -f
.
To shut down the containers, go to tests
directory and run docker compose down
.
Under the root directory, run:
vendor/bin/phpunit
You can also run just a specific set of tests:
vendor/bin/phpunit tests/ConceptTest.php
It has been noticed that disabling the xdebug
feature of PHP (if set up) speeds up the local testing process.