Skip to content

Symfony 5.4 phpunit 9.5 with forceCoversAnnotation and beStrictAboutCoversAnnotation giving random failures #178

@rbaarsma

Description

@rbaarsma

We just started a new project with Symfony 5.4 and phpunit 9.5. We've only implemented standard authetnication and some basic entities and cruds, but already see strange random issues in the tests.

We are executing:

find tests/ -name \"*Test.php\" | vendor/liuggio/fastest/fastest \"XDEBUG_MODE=coverage bin/phpunit {} --coverage-php cov/fastest/{n}.cov;\"
XDEBUG_MODE=coverage tools/phpcov merge cov/fastest/ --text cov/text.txt --html public/test.html

The errors we are getting are all warnings about Risky tests, ex:

There was 1 risky test:

1) Tests\Repository\OrganizationRepositoryTest::test
This test executed code that is not listed as code to be covered or used:
- /var/www/app/src/Entity/User.php:17

/var/www/app/vendor/phpunit/phpunit/src/Framework/TestResult.php:859
/var/www/app/vendor/phpunit/phpunit/src/Framework/TestSuite.php:678
/var/www/app/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:670

In every case the risky message is simply not true. If we execute the test solo (with coverage) or execute the suite without fastest, it works without any risky tests.

For now I've disabled beStrictAboutCoversAnnotation and it works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions