mardi 7 avril 2015

Create a mock of a class in a different namespace in PHPUnit

I want to create a mock of a class in a different namespace. I tried the following code



$fake = $this->getMockClass( __NAMESPACE__ . '\FakeTestBlock', array(), array(), '\NewNameSpace\GlobalFakeTestBlock' );


But I am getting the following error


PHPUnit_Framework_Exception: Parse error: parse error, expecting `"identifier (T_STRING)"' in /path/to/vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Generator.php(335) : eval()'d code on line 1


Is there a way to create the mock in a different namespace?


Aucun commentaire:

Enregistrer un commentaire