-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHPUnit silently ignores the return value on a void method #3602
Comments
Thank you for bringing this to my attention. Unfortunately, this is not as easy to fix as it should be or as one might assume it is. In your example, the call to However, inside TL;DR Fixing this issue very likely requires a substantial refactoring of the runtime (not the code generation) part of PHPUnit's test double functionality. |
Thank you for the explanation. I understand the problem. |
This is a special case of #3122. |
PHPUnit Code Sprint with bschulze
PHPUnit Code Sprint with bschulze
PHPUnit Code Sprint with bschulze
The new version contains some improvements in handling mocks (sebastianbergmann/phpunit#3602) and will help identify some existing issues in DBAL 3.0 tests: There were 2 warnings: 1) Doctrine\Tests\DBAL\Driver\OCI8\OCI8StatementTest::testExecute with data set #0 (array('test', null, 'value')) Method bindValue may not return value of type boolean 2) Doctrine\Tests\DBAL\Driver\OCI8\OCI8StatementTest::testExecute with data set #1 (array(null, 'test', 'value')) Method bindValue may not return value of type boolean
The new version contains some improvements in handling mocks (sebastianbergmann/phpunit#3602) and will help identify some existing issues in DBAL 3.0 tests: There were 2 warnings: 1) Doctrine\Tests\DBAL\Driver\OCI8\OCI8StatementTest::testExecute with data set #0 (array('test', null, 'value')) Method bindValue may not return value of type boolean 2) Doctrine\Tests\DBAL\Driver\OCI8\OCI8StatementTest::testExecute with data set #1 (array(null, 'test', 'value')) Method bindValue may not return value of type boolean
The new version contains some improvements in handling mocks (sebastianbergmann/phpunit#3602) and will help identify some existing issues in DBAL 3.0 tests: There were 2 warnings: 1) Doctrine\Tests\DBAL\Driver\OCI8\OCI8StatementTest::testExecute with data set #0 (array('test', null, 'value')) Method bindValue may not return value of type boolean 2) Doctrine\Tests\DBAL\Driver\OCI8\OCI8StatementTest::testExecute with data set #1 (array(null, 'test', 'value')) Method bindValue may not return value of type boolean
Consider the following test:
The test passes:
The test shouldn't pass since the
willReturn(true)
behavior cannot be achieved.Fixing this issue could help keep existing tests up to date when the return value of a method is changed from something to
void
.The text was updated successfully, but these errors were encountered: