/** * Create a storage from its parameters * * @param string $mountPoint storage mount point * @param string $backend backend identifier * @param string $authMechanism authentication mechanism identifier * @param array $backendOptions backend-specific options * @param array|null $mountOptions mount-specific options * @param array|null $applicableUsers users for which to mount the storage * @param array|null $applicableGroups groups for which to mount the storage * @param int|null $priority priority * * @return StorageConfig|DataResponse */ protected function createStorage($mountPoint, $backend, $authMechanism, $backendOptions, $mountOptions = null, $applicableUsers = null, $applicableGroups = null, $priority = null) { try { return $this->service->createStorage($mountPoint, $backend, $authMechanism, $backendOptions, $mountOptions, $applicableUsers, $applicableGroups, $priority); } catch (\InvalidArgumentException $e) { return new DataResponse(['message' => (string) $this->l10n->t('Invalid backend or authentication mechanism class')], Http::STATUS_UNPROCESSABLE_ENTITY); } }
/** * @expectedException \InvalidArgumentException */ public function testCreateStorageInvalidAuthMechanismClass() { $this->service->createStorage('mount', 'identifier:\\OCA\\Files_External\\Lib\\Backend\\SMB', 'identifier:\\Not\\An\\Auth\\Mechanism', []); }