# Phpunit createMock() method not found on CircleCI

**URL:** <https://discuss.circleci.com/t/phpunit-createmock-method-not-found-on-circleci/5271>\
**Category:** Build Environment\
**Created:** [July 22, 2016, 2:26pm UTC](https://discuss.circleci.com/t/phpunit-createmock-method-not-found-on-circleci/5271 "2016-07-22T14:26:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbennegent](https://avatars.discourse-cdn.com/v4/letter/j/dfb087/32.png) [@jbennegent](https://discuss.circleci.com/u/jbennegent)\
**Post date:** [July 22, 2016, 2:26pm UTC](https://discuss.circleci.com/t/phpunit-createmock-method-not-found-on-circleci/5271/1 "2016-07-22T14:26:59Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![jbennegent](https://avatars.discourse-cdn.com/v4/letter/j/dfb087/32.png) [@jbennegent](https://discuss.circleci.com/u/jbennegent)\
**Post date:** [July 25, 2016, 8:41am UTC](https://discuss.circleci.com/t/phpunit-createmock-method-not-found-on-circleci/5271/2 "2016-07-25T08:41:19Z")

</div>

Hello,

I finally use [https://github.com/Codeception/AspectMock](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

---

<div class="post-metadata">

**Author:** ![rulatir](https://avatars.discourse-cdn.com/v4/letter/r/6de8d8/32.png) [@rulatir](https://discuss.circleci.com/u/rulatir)\
**Post date:** [November 9, 2016, 9:36pm UTC](https://discuss.circleci.com/t/phpunit-createmock-method-not-found-on-circleci/5271/3 "2016-11-09T21:36:02Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [June 18, 2018, 11:38am UTC](https://discuss.circleci.com/t/phpunit-createmock-method-not-found-on-circleci/5271/4 "2018-06-18T11:38:31Z")

</div>


