I have following code:
class Foo() {
public function someMethod() {
...
if ($this->otherMethod($lorem, $ipsum)) {
...
}
...
}
}
and I'm trying to test the someMethod(), I don't want to test otherMethod() since it's quite complex and I have dedicated tests - here I would only like to mock it and return specific values. So I tried to:
$fooMock = Mockery::mock(Foo::class)
->makePartial();
$fooMock->shouldReceive('otherMethod')
->withAnyArgs()
->andReturn($otherMethodReturnValue);
and in test I'm calling
$fooMock->someMethod()
But it's using the original (not mocked) method otherMethod() and prints errors.
Argument 1 passed to Mockery_3_Foo::otherMethod() must be an instance of SomeClass, boolean given
Could you help me please?