You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.
Making a change like this would break many existing tests. Remember that PHPUnit_Framework_TestCase::getMock() is not only used for creating mocks, but for the entire spectrum of test doubles.
If you read http://www.phpunit.de/manual/current/en/test-doubles.html, this is expected behavior. By default PHPUnit_Framework_TestCase::getMock() returns a stub object that just returns null for all methods. It's really up to you as the programmer to decide how to use this object. To force a programmer to mock every possible invocation of every method in this object would be unreasonable in many situations.
For what it's worth, the invocation recorders like PHPUnit_Framework_TestCase::once() and PHPUnit_Framework_TestCase::exactly() are set up specifically for the type of situation you are describing. If you want to assert that a mocked method is only called once, you should use PHPUnit_Framework_TestCase::once().
Copied from http://www.phpunit.de/ticket/854
The text was updated successfully, but these errors were encountered: