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
The createTestProxy() method can be used to create a so-called test proxy: an object where all methods of the original class are replaced with an implementation that can be configured to expect an invocation but otherwise retains its original behaviour. They are "documented" here.
While the idea for test proxies was appealing, I have never seen this feature used "in the wild" to a degree that would warrant keeping it around.
To reduce complexity inside PHPUnit's test double functionality, TestCase::createTestProxy() will be deprecated and then removed:
soft deprecation in PHPUnit 10.1 (add @deprecated annotation to the method declaration)
deprecation in PHPUnit 11 (using the method will trigger a deprecation)
removal in PHPUnit 12
The text was updated successfully, but these errors were encountered:
I was implementing this method right now. How am I supposed to assert things inside a method that has a return type void if I can't do a proxy in one of its dependencies to assert the values?
Edit: I used the $this->createStub to create a class and did assertions inside the ::method::willReturnCallback. Is this horrible? Is there a better way to do it?
The
createTestProxy()
method can be used to create a so-called test proxy: an object where all methods of the original class are replaced with an implementation that can be configured to expect an invocation but otherwise retains its original behaviour. They are "documented" here.While the idea for test proxies was appealing, I have never seen this feature used "in the wild" to a degree that would warrant keeping it around.
To reduce complexity inside PHPUnit's test double functionality,
TestCase::createTestProxy()
will be deprecated and then removed:@deprecated
annotation to the method declaration)The text was updated successfully, but these errors were encountered: