From 692e30465dd0b0dcd302eccc26af34148d17667b Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 14 Aug 2024 21:54:34 +0200 Subject: Update about running tests (#6709) --- docs/en/developers/03_Running_tests.md | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'docs') diff --git a/docs/en/developers/03_Running_tests.md b/docs/en/developers/03_Running_tests.md index be2414d80..dabff8477 100644 --- a/docs/en/developers/03_Running_tests.md +++ b/docs/en/developers/03_Running_tests.md @@ -1,32 +1,36 @@ # Running tests -FreshRSS is tested with [PHPUnit](https://phpunit.de/). No code should be merged in `edge` if the tests don’t pass. +FreshRSS is tested with [PHPUnit](https://phpunit.de/), [PHPStan](https://phpstan.org/), [PHP\_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer/), and more. +No code should be merged in `edge` if the tests don’t pass. ## Locally As a developer, you can run the test suite on your PC easily with `make` commands. You can run the test suite with: ```sh -make test +cd ./FreshRSS/ +make test-all ``` -This command downloads the PHPUnit binary and verifies its checksum. If the verification fails, the file is deleted. In this case, you should [open an issue on GitHub](https://github.com/FreshRSS/FreshRSS/issues/new) to let maintainers know about the problem. - -Then, it executes PHPUnit in a Docker container. If you don’t use Docker, you can run the command directly with: +Some syntax, formatting, whitespace, and i18n conventions can be fixed automatically with: ```sh -NO_DOCKER=true make test +make fix-all ``` -The linter can be run with a `make` command as well: +Some tests can run inside some Docker images, in particular to test against minimum and maximum versions of PHP: ```sh -make lint # to execute the linter on the PHP files -make lint-fix # or, to fix the errors detected by the linter +# Prepare +make composer-test +docker build --pull --tag freshrss/freshrss:oldest -f Docker/Dockerfile-Oldest . +docker build --pull --tag freshrss/freshrss:newest -f Docker/Dockerfile-Newest . + +# Run +docker run --rm -e FRESHRSS_ENV=development -e TZ=UTC -v $(pwd):/var/www/FreshRSS freshrss/freshrss:oldest bin/composer test +docker run --rm -e FRESHRSS_ENV=development -e TZ=UTC -v $(pwd):/var/www/FreshRSS freshrss/freshrss:newest bin/composer test ``` -Similarly to PHPUnit, it downloads a [PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) binary (i.e. `phpcs` or `phpcbf` depending on the command) and verifies its checksum. - ## GitHub Actions for Continuous Integration Tests are automatically run when you open a pull request on GitHub. -- cgit v1.2.3