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
$object = newTest();
$mock1 = \Mockery::instanceMock($object)->makePartial();
// ^ $mock1 is the same as $mock2 ⌄$mock2 = \Mockery::mock($object)->makePartial();
It intercepts calls and reroutes them to the proxied object (which we construct and pass in) for methods which are not subject to any expectations. Indirectly, this allows us to mock methods marked final since the Proxy is not subject to those limitations. The tradeoff should be obvious - a proxied partial will fail any typehint checks for the class being mocked since it cannot extend that class.
In the example code you provided, the test2() method does not have any expectations, so mockery intercepts that call and reroutes it to the proxied object (returning "own").
results in
string(4) "mock"
string(3) "own"
string(4) "mock"
string(4) "mock"
Instance mock does not mock test method which is called from test2 method. I did not find any documentation stating this behaviour.
The text was updated successfully, but these errors were encountered: