Skip to content

Instantly share code, notes, and snippets.

View gmansilla's full-sized avatar

Guillermo Mansilla gmansilla

  • Amazon Web Services (AWS)
  • Orlando, Florida. USA
  • LinkedIn in/gmansilla
View GitHub Profile
@wowo
wowo / PHPUnit way to mock Doctrine2 Entity Manager.php
Created November 1, 2011 20:22
PHPUnit's way to mock Doctrine2 Entity Manager
<?php
class AbstractManagerBase extends \PHPUnit_Framework_TestCase
{
protected function getEmMock()
{
$emMock = $this->getMock('\Doctrine\ORM\EntityManager',
array('getRepository', 'getClassMetadata', 'persist', 'flush'), array(), '', false);
$emMock->expects($this->any())
->method('getRepository')