public function test_can_boot_service_provider_with_two_connection()
 {
     $this->registry->shouldReceive('getManagers')->once()->andReturn(['default' => $this->em, 'custom' => $this->em]);
     $this->em->shouldReceive('getConfiguration')->twice()->andReturn($this->configuration);
     $this->configuration->shouldReceive('getMetadataDriverImpl')->twice()->andReturn($this->chain);
     $this->chain->shouldReceive('getReader')->twice()->andReturn($this->reader);
     $this->chain->shouldReceive('addDriver')->twice();
     $this->app->shouldReceive('make')->with('config')->twice()->andReturn($this->config);
     $this->config->shouldReceive('get')->with('doctrine.gedmo.all_mappings', false)->twice()->andReturn(true);
     $this->provider->boot($this->registry);
 }
예제 #2
0
 public function test_can_add_paths_to_default_connection()
 {
     $this->registry->shouldReceive('getManager')->once()->with('default')->andReturn($this->em);
     $configuration = m::mock(Configuration::class);
     $mappingDriver = m::mock(MappingDriverChain::class);
     $mappingDriver->shouldReceive('addPaths')->once()->with(['paths']);
     $configuration->shouldReceive('getMetadataDriverImpl')->once()->andReturn($mappingDriver);
     $this->em->shouldReceive('getConfiguration')->once()->andReturn($configuration);
     $this->manager->addPaths(['paths'], 'default');
 }