/** * @param $manager * @param array $settings */ public function addManager($manager, array $settings = []) { if (!$this->container->bound($this->getManagerBindingName($manager))) { $this->container->singleton($this->getManagerBindingName($manager), function () use($settings) { return $this->factory->create($settings); }); $this->managers[$manager] = $manager; } }
public function test_can_decorate_the_entity_manager() { $this->disableDebugbar(); $this->disableSecondLevelCaching(); $this->disableCustomCacheNamespace(); $this->disableCustomFunctions(); $this->enableLaravelNamingStrategy(); $this->settings['decorator'] = Decorator::class; $manager = $this->factory->create($this->settings); $this->assertEntityManager($manager); $this->assertInstanceOf(Decorator::class, $manager); $this->assertInstanceOf(EntityManagerDecorator::class, $manager); }
public function test_can_set_repository_factory() { $this->disableDebugbar(); $this->disableSecondLevelCaching(); $this->disableCustomCacheNamespace(); $this->disableCustomFunctions(); $this->enableLaravelNamingStrategy(); $this->settings['repository_factory'] = 'RepositoryFactory'; $repositoryFactory = m::mock(RepositoryFactory::class); $this->container->shouldReceive('make')->with('RepositoryFactory')->once()->andReturn($repositoryFactory); $this->configuration->shouldReceive('setRepositoryFactory')->once()->with($repositoryFactory); $manager = $this->factory->create($this->settings); $this->assertEntityManager($manager); }