phpunit icon indicating copy to clipboard operation
phpunit copied to clipboard

failOnWarning="true" but tests with warnings marked as passed in PHPStorm

Open doctorby opened this issue 4 years ago • 0 comments

Q A
PHPUnit version 8.5.16
PHP version 7.4.20
Installation Method Composer

Summary

Was introduced here https://github.com/sebastianbergmann/phpunit/pull/4623

Running tests from PHPSTORM, before PHPUnit 8.5.15, having failOnWarning="true", test with warnings was marked as failed, now it's marked as passed.

Current behavior

Tests with warnings marked as passed in PHPSTORM

image

How to reproduce

Create test. Make mistake in dataprovider method or in setUp e.g. try to configure a method that does not exist in mocked class Run test Test marked as passed

Expected behavior

Having failOnWarning="true" -> tests with a warning should be marked as failed image

I understand there were some reasons for https://github.com/sebastianbergmann/phpunit/pull/4623

But there must be some other solution. Why is it important? With just one mistake in the seUp() method (e.g. ->method('not_existed_method') ), all tests inside the class will not be executed, but will be marked as "passed" - obviously this is not what is expected.

If I remove method from class, I expect that tests, where such method was configured, will fail

doctorby avatar Jun 15 '21 12:06 doctorby