I have just tried to implement a stub object for a unit test in PHP using PHPUnit.
Normally no problem there.
This time, the object I am stubbing is passed into the constructor of my tested object, but the constructor uses type hinting to an interface.
Everything I try causes an error similar to this one:
ErrorException: Catchable Fatal Error: Argument 1 passed to xxx\xxx\xx::__construct() must be an instance of xxx\xxx\DataRepositoryInterface, instance of Mock_DataRepositoryInterface_9f459e93 given, called in D:\_projects\xxx.php on line 22 and defined in D:\_projects\yyy.php line 12
If anyone has any suggestions about this, I would love to hear them...
No comments:
Post a Comment