File tree Expand file tree Collapse file tree 2 files changed +7
-21
lines changed
src/Dflydev/Provider/DoctrineOrm
tests/Dflydev/Tests/Provider/DoctrineOrm Expand file tree Collapse file tree 2 files changed +7
-21
lines changed Original file line number Diff line number Diff line change @@ -357,26 +357,12 @@ public function register(Container $container)
357357 });
358358
359359 $ container ['orm.cache.factory ' ] = $ container ->protect (function ($ driver , $ cacheOptions ) use ($ container ) {
360- switch ($ driver ) {
361- case 'array ' :
362- return $ container ['orm.cache.factory.array ' ]();
363- case 'apc ' :
364- return $ container ['orm.cache.factory.apc ' ]();
365- case 'xcache ' :
366- return $ container ['orm.cache.factory.xcache ' ]();
367- case 'memcache ' :
368- return $ container ['orm.cache.factory.memcache ' ]($ cacheOptions );
369- case 'memcached ' :
370- return $ container ['orm.cache.factory.memcached ' ]($ cacheOptions );
371- case 'filesystem ' :
372- return $ container ['orm.cache.factory.filesystem ' ]($ cacheOptions );
373- case 'redis ' :
374- return $ container ['orm.cache.factory.redis ' ]($ cacheOptions );
375- case 'couchbase ' :
376- return $ container ['orm.cache.factory.couchbase ' ]($ cacheOptions );
377- default :
378- throw new \RuntimeException ("Unsupported cache type ' $ driver' specified " );
360+ $ cacheFactoryKey = 'orm.cache.factory. ' .$ driver ;
361+ if (!isset ($ container [$ cacheFactoryKey ])) {
362+ throw new \RuntimeException ("Factory ' $ cacheFactoryKey' for cache type ' $ driver' not defined (is it spelled correctly?) " );
379363 }
364+
365+ return $ container [$ cacheFactoryKey ]($ cacheOptions );
380366 });
381367
382368 $ container ['orm.mapping_driver_chain.locator ' ] = $ container ->protect (function ($ name = null ) use ($ container ) {
Original file line number Diff line number Diff line change @@ -226,7 +226,7 @@ public function testInvalidCacheTypeNamed()
226226
227227 $ this ->fail ('Expected invalid query cache driver exception ' );
228228 } catch (\RuntimeException $ e ) {
229- $ this ->assertEquals ("Unsupported cache type 'INVALID' specified " , $ e ->getMessage ());
229+ $ this ->assertEquals ("Factory 'orm. cache.factory.INVALID' for cache type 'INVALID' not defined (is it spelled correctly?) " , $ e ->getMessage ());
230230 }
231231 }
232232
@@ -250,7 +250,7 @@ public function testInvalidCacheTypeDriverAsOption()
250250
251251 $ this ->fail ('Expected invalid query cache driver exception ' );
252252 } catch (\RuntimeException $ e ) {
253- $ this ->assertEquals ("Unsupported cache type 'INVALID' specified " , $ e ->getMessage ());
253+ $ this ->assertEquals ("Factory 'orm. cache.factory.INVALID' for cache type 'INVALID' not defined (is it spelled correctly?) " , $ e ->getMessage ());
254254 }
255255 }
256256
You can’t perform that action at this time.
0 commit comments