Testing
LibreSign includes multiple test suites (see .github/workflows
for CI jobs).
Below are the most relevant for day-to-day development and how to run them locally.
Tips
Keep your local branches rebased and dependencies up to date to reduce noise in lints and type checks.
Tests and CI are also part of the documentation, check
.github/workflows
and thetests
folder for usage examples.
Unit tests
Run a specific unit test (filter by class, method, or pattern):
composer test:unit -- --filter MyClassTest
Note
The double dash --
is required to pass arguments to the script
test:unit
(and not to Composer itself).
Running the entire unit suite locally may take a while. Prefer filtering by the tests you added or modified.
Integration tests (Behat)
Integration tests live under tests/integration
. To run them:
Install dependencies inside that folder:
cd tests/integration composer install
Run a specific scenario (example):
runuser -u www-data -- vendor/bin/behat --xdebug features/account/me.feature:5
The example above executes the scenario that starts at line 5 of
features/account/me.feature
.
Static analysis
PHPCS (coding style):
composer cs:fix
Psalm (type analysis):
composer psalm
Update Psalm baseline (only when appropriate):
composer psalm:update-baseline
JavaScript linters
ESLint and Stylelint:
npm run lint:fix
npm run stylelint:fix