public function testUseDefinedDefaultStorage() { $this->storageManager->add('core', new MemoryStorage()); $this->storageManager->add('storage', new LocalStorage()); $this->storageManager->setDefault('storage'); $this->assertEquals('storage', $this->storageManager->getDefault()); }
protected function registerStorageManager() { $this->app['simple-photo.storage-manager'] = $this->app->share(function ($app) { $storageManager = new StorageManager(); $storageLocations = $app['config']['morrelinko/laravel-simple-photo::storage_locations']; foreach ($storageLocations as $storageName => $storageLocation) { $storageManager->add($storageName, $app['simple-photo.storage-factory']->createStorage($storageLocation['storage'], $storageLocation['options'])); } $storageManager->setDefault($app['config']['morrelinko/laravel-simple-photo::default_storage']); $fallbackStorage = $app['config']['morrelinko/laravel-simple-photo::fallback_storage']; if ($fallbackStorage) { $storageManager->setFallback($storageManager->get($fallbackStorage)); } return $storageManager; }); }