File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,19 @@ public function resolve($name)
9090
9191        $ configadd ($ config'store ' , $ name
9292
93+         return  $ this build ($ config
94+     }
95+ 
96+     /** 
97+      * Build a cache repository with the given configuration. 
98+      * 
99+      * @param  array  $config 
100+      * @return \Illuminate\Cache\Repository 
101+      */ 
102+     public  function  build (array  $ config
103+     {
104+         $ configadd ($ config'store ' , $ config'name ' ] ?? 'ondemand ' );
105+ 
93106        if  (isset ($ this customCreators [$ config'driver ' ]])) {
94107            return  $ this callCustomCreator ($ config
95108        }
Original file line number Diff line number Diff line change 66 * @method static \Illuminate\Contracts\Cache\Repository store(string|null $name = null) 
77 * @method static \Illuminate\Contracts\Cache\Repository driver(string|null $driver = null) 
88 * @method static \Illuminate\Contracts\Cache\Repository resolve(string $name) 
9+  * @method static \Illuminate\Contracts\Cache\Repository build(array $config) 
910 * @method static \Illuminate\Cache\Repository repository(\Illuminate\Contracts\Cache\Store $store, array $config = []) 
1011 * @method static void refreshEventDispatcher() 
1112 * @method static string getDefaultDriver() 
Original file line number Diff line number Diff line change @@ -59,6 +59,18 @@ public function testCustomDriverOverridesInternalDrivers()
5959        $ this assertSame ('mm(u_u)mm ' , $ driverflag );
6060    }
6161
62+     public  function  testItCanBuildRepositories ()
63+     {
64+         $ app$ this getApp ([]);
65+         $ cacheManagernew  CacheManager ($ app
66+ 
67+         $ arrayCache$ cacheManagerbuild (['driver '  => 'array ' ]);
68+         $ nullCache$ cacheManagerbuild (['driver '  => 'null ' ]);
69+ 
70+         $ this assertInstanceOf (ArrayStore::class, $ arrayCachegetStore ());
71+         $ this assertInstanceOf (NullStore::class, $ nullCachegetStore ());
72+     }
73+ 
6274    public  function  testItMakesRepositoryWhenContainerHasNoDispatcher ()
6375    {
6476        $ userConfig
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments