Skip to content

Commit

Permalink
Update about running tests (FreshRSS#6709)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkarex authored Aug 14, 2024
1 parent 396d5cc commit 692e304
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 123 deletions.
4 changes: 4 additions & 0 deletions Docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ They need to be compiled manually:
cd ./FreshRSS/
docker build --pull --tag freshrss/freshrss:oldest -f Docker/Dockerfile-Oldest .
docker build --pull --tag freshrss/freshrss:newest -f Docker/Dockerfile-Newest .

# Example of use:
make composer-test
docker run --rm -e FRESHRSS_ENV=development -e TZ=UTC -v $(pwd):/var/www/FreshRSS freshrss/freshrss:oldest bin/composer test
```

## Supported databases
Expand Down
1 change: 0 additions & 1 deletion app/Models/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ public function load(bool $loadDetails = false, bool $noCache = false): ?SimpleP
if ($this->url != '') {
/**
* @throws Minz_FileNotExistException
* @phpstan-ignore if.alwaysFalse
*/
if (CACHE_PATH == '') {
throw new Minz_FileNotExistException(
Expand Down
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 15 additions & 11 deletions docs/en/developers/03_Running_tests.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Loading

0 comments on commit 692e304

Please sign in to comment.