I'm writing some Unit Tests using PHP Prophecy as Mocking Framework.
I'm trying to make a test to assure a void method is called, the code looks something like this:
private Prophet $prophet;
protected function setUp()
{
$this->prophet = new Prophet();
}
protected function tearDown()
{
$this-prophet->checkPredictions();
}
public function testFoo()
{
$fooMock = $this->prophet->prophesize(Foo::class);
$fooMock->execute()->shouldBeCalled();
$fooMock->reveal();
...
}
Each time I'm trying to execute the test I'm getting the following error:
Prophecy\Exception\Call\UnexpectedCallException: Unexpected method call on Double\App\Foo\P1
On my other test where I check that execute is not called everything works perfectly fine.