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
Using alias/instance mocks across more than one test will generate a fatal error since we can’t have two classes of
the same name. To avoid this, run each test of this kind in a separate PHP process (which is supported out of the box by
both PHPUnit and PHPT).
Instead of a fatal error, I see some odd behaviour that could either be a bug or something that should be documented:
I can overload the same class multiple times in the same PHP process. When I overload a class twice in the same test (which I did to find the limits of creating instance mocks), I found that only the expectations of the first overload are taken into account. Any assertions on a second overload of the same class are ignored without warning.
The Mockery docs about overloading mention:
Instead of a fatal error, I see some odd behaviour that could either be a bug or something that should be documented:
I can overload the same class multiple times in the same PHP process. When I overload a class twice in the same test (which I did to find the limits of creating instance mocks), I found that only the expectations of the first overload are taken into account. Any assertions on a second overload of the same class are ignored without warning.
Here's the code that I used: https://github.com/jrfnl/bug-report-reproduction-scenarios/tree/mockery/overload-implementation-question
Am I interpreting the docs incorrectly? When should I expect a fatal error when creating instance mocks?
The text was updated successfully, but these errors were encountered: