protected function setUp()
 {
     parent::setUp();
     $this->galleryManager = $this->getMock('Sonata\\MediaBundle\\Model\\GalleryManagerInterface');
     $this->pool = $this->getMockBuilder('Sonata\\MediaBundle\\Provider\\Pool')->disableOriginalConstructor()->getMock();
     $this->templating = new FakeTemplating();
 }
 protected function setUp()
 {
     parent::setUp();
     $this->templating = new FakeTemplating();
     $this->contextManager = $this->getMock('Sonata\\ClassificationBundle\\Model\\ContextManagerInterface');
     $this->categoryManager = $this->getMock('Sonata\\ClassificationBundle\\Model\\CategoryManagerInterface');
     $this->categoryAdmin = $this->getMockBuilder('Sonata\\ClassificationBundle\\Admin\\CategoryAdmin')->disableOriginalConstructor()->getMock();
 }
 protected function setUp()
 {
     parent::setUp();
     $this->pool = $this->getMockBuilder('Sonata\\AdminBundle\\Admin\\Pool')->disableOriginalConstructor()->getMock();
 }
 protected function setUp()
 {
     parent::setUp();
     $this->pageManager = $this->getMock('Sonata\\PageBundle\\Model\\PageManagerInterface');
     $this->templating = new FakeTemplating();
 }
 /**
  * Prepares the environment before running a test.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->name = 'foo';
     //Mock building
     $this->templating = $this->getMock('Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface');
     $this->pool = $this->getMockBuilder('Sonata\\AdminBundle\\Admin\\Pool')->disableOriginalConstructor()->getMock();
     $this->em = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock();
     $this->securityContext = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\SecurityContext')->disableOriginalConstructor()->getMock();
     $this->token = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface');
     $this->user = $this->getMock('Application\\Sonata\\UserBundle\\Entity\\User');
     $this->logRepository = $this->getMockBuilder('Jdr\\AppBundle\\Entity\\Repository\\LogRepository')->disableOriginalConstructor()->getMock();
     $this->registryRepository = $this->getMockBuilder('Jdr\\AppBundle\\Entity\\Repository\\RegistryRepository')->disableOriginalConstructor()->getMock();
     $this->registry = $this->getMock('Jdr\\AppBundle\\Entity\\Registry');
     //Expected returns
     $this->securityContext->expects($this->any())->method('getToken')->will($this->returnValue($this->token));
     $this->token->expects($this->any())->method('getUser')->will($this->returnValue($this->user));
     $this->em->expects($this->any())->method('getRepository')->will($this->returnCallback(function ($label) {
         if ('JdrAppBundle:Registry' == $label) {
             return $this->registryRepository;
         }
         return $this->logRepository;
     }));
     $this->registry->expects($this->any())->method('getId')->will($this->returnValue(5));
     $this->registryRepository->expects($this->any())->method('findOwnerRegistry')->will($this->returnValue($this->registry));
     $this->registryRepository->expects($this->any())->method('findAdministratorRegistry')->will($this->returnValue($this->registry));
     $this->registryRepository->expects($this->any())->method('findModeratorRegistry')->will($this->returnValue($this->registry));
     $this->registryRepository->expects($this->any())->method('findCommunityManagerRegistry')->will($this->returnValue($this->registry));
     $this->registryRepository->expects($this->any())->method('findFounderRegistry')->will($this->returnValue($this->registry));
     $this->logsBlockService = new LogsBlockService($this->name, $this->templating, $this->pool, $this->em, $this->securityContext);
 }