protected function mockEntityManager()
 {
     $this->entityManager = \Mockery::mock('Doctrine\\ORM\\EntityManager')->shouldDeferMissing()->shouldAllowMockingProtectedMethods();
     $this->entityManager->shouldReceive('getRepository')->withAnyArgs()->andReturnSelf();
     $this->entityManager->shouldReceive('getRepositoryFactory')->withAnyArgs()->andReturnSelf();
     $this->mockEntityManagerCommands();
 }
 protected function mockEntityManager()
 {
     $this->entityManager = \Mockery::mock('Doctrine\\ORM\\EntityManager')->shouldDeferMissing()->shouldAllowMockingProtectedMethods();
     $this->entityManager->shouldReceive('getRepository')->withAnyArgs()->andReturnSelf();
     $this->entityManager->shouldReceive('getRepositoryFactory')->withAnyArgs()->andReturnSelf();
     $this->entityManager->shouldReceive('findDistrictCouncilByNameAndEntityCode')->once()->andReturn(array((new DistrictCouncil('Code', 'Name'))->setId(22)->setDateCreated($this->expectedDate)));
     $this->entityManager->shouldReceive('findDistrictCouncilByNameAndEntityCode')->andReturn(func_get_args());
     $this->entityManager->shouldReceive('findOneBy')->once()->andReturn((new DistrictCouncil('Code', 'Name'))->setId(22)->setDateCreated($this->expectedDate));
     $this->entityManager->shouldReceive('findOneBy')->once()->andReturn(func_get_args());
     $this->entityManager->shouldReceive('persist')->withAnyArgs()->andReturnSelf();
     $this->entityManager->shouldReceive('flush')->withAnyArgs()->andReturnSelf();
     $this->entityManager->shouldReceive('findDistrictCouncilsByName')->withAnyArgs()->andReturn(array());
 }
 protected function mockEntityManager()
 {
     $this->entityManager = \Mockery::mock('Doctrine\\ORM\\EntityManager')->shouldDeferMissing()->shouldAllowMockingProtectedMethods();
     $this->entityManager->shouldReceive('getRepository')->withAnyArgs()->andReturnSelf();
     $this->entityManager->shouldReceive('getRepositoryFactory')->withAnyArgs()->andReturnSelf();
     $this->entityManager->shouldReceive('findOneBy')->once()->withAnyArgs()->andReturn((new Authority())->setCounty(new County('Code', 'Name'))->setLha(new LocalHealthAuthority('Code', 'Name'))->setDistrictCouncil(new DistrictCouncil('Code', 'Name'))->setId(22)->setDateCreated($this->expectedDate));
     $this->entityManager->shouldReceive('findOneBy')->withAnyArgs()->once()->andReturn(func_get_args());
     $this->entityManager->shouldReceive('persist')->withAnyArgs()->andReturnSelf();
     $this->entityManager->shouldReceive('flush')->withAnyArgs()->andReturnSelf();
     $this->entityManager->shouldReceive('findByPostCode')->withAnyArgs()->andReturn((new Authority())->setPostcode('AA1 BB3')->setDateCreated($this->expectedDate));
 }
 private function mockApiCallLoad()
 {
     $this->entityManager->shouldReceive('find')->with('TariochEveapiFetcherBundle:ApiCall', self::API_CALL_ID)->andReturn($this->apiCall);
     $this->apiCall->shouldReceive('getOwner')->andReturn(null);
 }