/** * 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; }
/** * @test */ public function shouldConfigureXcacheCache() { $this->configuration->shouldReceive('get')->with('cache')->andReturn(['type' => 'Xcache']); $configuredCache = $this->cache->configureCache(); $this->assertInstanceOf('Doctrine\\Common\\Cache\\XcacheCache', $configuredCache); }