I'm stubbing a class in PHPUnit. I need to stub a method on that class called expects
. However, that method already exists on the PHPUnit mocking base class. How would I circumvent that?
It obviously throws because I'm trying to redeclare expects
(Fatal error: Cannot redeclare Mock_Inlet_399f0eba::expects()
)
$inlet = $this->getMockForAbstractClass(Inlet::class);
If I tried to stub a method called method
, I could do...
$inlet->expects($this->any())->method('method')->willReturn([Foo::class]);
...as the mock is placed on InvocationMocker
instead of the plain MockObject
.
Is there a similar workaround for methods called expects
, or will I have to either rename the method or mock it with some other mocking framework?