예제 #1
0
 public function test_can_replace_an_existing_driver()
 {
     $this->manager->extend('memcache', function () {
         return 'provider';
     });
     $this->assertEquals('provider', $this->manager->driver('memcache'));
 }
 /**
  * @param Configuration $configuration
  */
 protected function setSecondLevelCaching(Configuration $configuration)
 {
     if ($this->config->get('doctrine.cache.second_level', false)) {
         $configuration->setSecondLevelCacheEnabled(true);
         $cacheConfig = $configuration->getSecondLevelCacheConfiguration();
         $cacheConfig->setCacheFactory(new DefaultCacheFactory($cacheConfig->getRegionsConfiguration(), $this->cache->driver()));
     }
 }
예제 #3
0
 /**
  * @return mixed
  */
 public function getCache()
 {
     if (config('doctrine.cache.default')) {
         return CacheManager::resolve(config('doctrine.cache.default'));
     }
 }
예제 #4
0
 public function test_a_string_class_can_be_use_as_extend()
 {
     CacheManager::extend('custom3', StubCacheProvider::class);
     $driver = CacheManager::resolve('custom3');
     $this->assertEquals('stub', $driver);
 }
예제 #5
0
 protected function mockConnection()
 {
     $this->connection = m::mock(ConnectionManager::class);
     $this->connection->shouldReceive('driver')->once()->with('mysql', ['driver' => 'mysql'])->andReturn(['driver' => 'pdo_mysql']);
 }
예제 #6
0
파일: Config.php 프로젝트: ryan-senn/orm
 /**
  * @param array $settings
  *
  * @return \Doctrine\ORM\Configuration|mixed
  */
 public function resolve(array $settings = [])
 {
     $configuration = Setup::createConfiguration(array_get($settings, 'dev'), array_get($settings, 'proxies.path'), $this->cache->driver());
     $configuration->setMetadataDriverImpl(new ConfigDriver($this->config->get(array_get($settings, 'mapping_file'), [])));
     return $configuration;
 }
예제 #7
0
 /**
  * Register the cache drivers
  */
 protected function setupCache()
 {
     CacheManager::registerDrivers($this->app->config->get('cache.stores', []));
 }