public function testInitWithComponent() { $this->destroyApplication(); $this->mockApplication(['components' => ['fs' => ['class' => 'creocoder\\flysystem\\LocalFilesystem', 'path' => sys_get_temp_dir()]]]); $storage = new Storage(['filesystemComponent' => 'fs']); $this->assertNotNull($storage->getFilesystem()); $this->assertInstanceOf("creocoder\\flysystem\\LocalFilesystem", $storage->getFilesystem()); }
/** * @return \yiioverflow\filekit\Storage * @throws \yii\base\InvalidConfigException */ protected function getFileStorage() { if ($this->allowChangeFilestorage) { $fileStorage = \Yii::$app->request->get($this->fileStorageParam); } else { $fileStorage = $this->fileStorage; } $fileStorage = Instance::ensure($fileStorage, Storage::className()); return $fileStorage; }