public function testAddAndRemoveStorage() { $mockStorage = \Mockery::mock('SimplePhoto\\Storage\\StorageInterface'); $this->storageManager->add('mock_storage', $mockStorage); $this->assertTrue($this->storageManager->has('mock_storage')); $this->storageManager->remove('mock_storage'); $this->assertFalse($this->storageManager->has('mock_storage')); }
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; }); }