/** * @test */ public function shouldBeAbleTaChangeNamingStrategy() { $this->configuration->shouldReceive('get')->with('mapping')->andReturn(['type' => 'yaml', 'path' => ['path/to/mapping/files'], "namingStrategy" => ["strategy" => "underscore", "case" => CASE_UPPER]]); $this->configuration->shouldReceive('get')->with('proxy')->andReturn(['path' => 'path/to/proxy/files']); $this->configuration->shouldReceive('get')->with('onProduction')->andReturn(true); $configuredDriver = $this->driver->configureDriver(); $this->assertInstanceOf('Doctrine\\ORM\\Mapping\\UnderscoreNamingStrategy', $configuredDriver->getNamingStrategy()); $this->assertEquals(CASE_UPPER, $configuredDriver->getNamingStrategy()->getCase()); }
/** * Create a \Doctrine\ORM\Configuration based on the config given. * If no config are given the method will try to get the config from the configuration file. * * @return \Doctrine\ORM\Configuration */ public function configureDoctrine() { $configuredCache = $this->cache->configureCache(); $configuredDriver = $this->mapping->configureDriver($configuredCache); foreach ($this->configuration->get('namespaces') as $namespace) { $this->driverChain->addDriver($configuredDriver->getMetadataDriverImpl(), $namespace); } $configuredDriver->setMetadataDriverImpl($this->driverChain); // Implement maximum caching $configuredDriver->setMetadataCacheImpl($configuredCache); $configuredDriver->setHydrationCacheImpl($configuredCache); $configuredDriver->setQueryCacheImpl($configuredCache); $configuredDriver->setResultCacheImpl($configuredCache); $proxyConfiguration = $this->configuration->get('proxy'); // Set proxies and proxie-prefix $configuredDriver->setProxyNamespace($proxyConfiguration['namespace']); $configuredDriver->setAutoGenerateProxyClasses($proxyConfiguration['generate']); return $configuredDriver; }