Phpunit createMock() method not found on CircleCI


#1

Hello,

I’m discovering CircleCI for a Symfony 3 project.

In my tests, I use the createMock() method of phpunit (https://phpunit.de/manual/current/en/test-doubles.html) to mock objects in my tests.

Apparently, I cannot use it on CircleCI :
PHP Fatal error: Uncaught Error: Call to undefined method MyBundle\Tests\Controller\MyControllerTest::createMock() in ...

Any additional configuration to perform to enable this ?

Thanks a lot


#2

Hello,

I finally use https://github.com/Codeception/AspectMock to handle mocking.
So I no longer call the createMock() method that was not found.

Hope this can help!

Regards


#3

Too bad you didn’t find what the problem with PHPUnit’s native createMock() was. I am experiencing the same issue, and I have determined with absolute certainty (using reflection) that my testcase DOES inherit from a base test case class that DOES define the createMock() method, but nonetheless method_exists($this,‘createMock’) returns false in my testcase class. This is an anomaly beyond my understanding - how can a method FAIL to be inherited?


#4