I created the following interface:
<?php
interface Action
{
public function execute(\requests\Request $request, array $params);
}
Then I try to make a Mock object of this interface with PHPUnit 3.4, but I get the following error:
Fatal error: Declaration of Mock_Action_b389c0b1::execute() must be compatible with that of Action::execute() in D:\Xampp\xampp\php\PEAR\PHPUnit\Framework\TestCase.php(1121) : eval()'d code on line 2
I looked through the stack trace I got from PHPUnit and found that it creates a Mock object that implements the interface Action, but creates the execute method in the following way:
<?php
public function execute($request, array $params)
As you can see, PHPUnit takes over the array type-hint, but forgets about \requests\Request. Which obviously leads to an error. Does anyone knows a workaround for this error?
I also tried it without namespaces, but I still get the same error.