<?php
final class FinalClass {}
class SomeClass
{
public function someMethod(FinalClass $p) {}
}
$p = new FinalClass;
$handle = mock(SomeClass::class);
$handle->someMethod->with($p)->returns('something');
It throws a Eloquent\Phony\Mock\Exception\FinalClassException as soon as $handle->someMethod is called.
I know final classes can't be mocked but I can't figure out why it is a problem here. Is it a limitation of the library and is there a workaround for this?
I can't get around this situation:
It throws a
Eloquent\Phony\Mock\Exception\FinalClassException
as soon as$handle->someMethod
is called.I know final classes can't be mocked but I can't figure out why it is a problem here. Is it a limitation of the library and is there a workaround for this?