Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions apps/files_external/lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
use OCP\AppFramework\Services\IInitialState;
use OCP\Encryption\IManager;
use OCP\IURLGenerator;
use OCP\Settings\ISettings;
use OCP\IL10N;
use OCP\Settings\IDelegatedSettings;

class Admin implements ISettings {
class Admin implements IDelegatedSettings {
use CommonSettingsTrait;

public function __construct(
Expand All @@ -26,6 +27,7 @@ public function __construct(
private GlobalAuth $globalAuth,
private IInitialState $initialState,
private IURLGenerator $urlGenerator,
private IL10N $l10n,
) {
$this->visibility = BackendService::VISIBILITY_ADMIN;
}
Expand Down Expand Up @@ -65,4 +67,12 @@ public function getSection() {
public function getPriority() {
return 40;
}

public function getName(): string {
return $this->l10n->t('External storage');
}

public function getAuthorizedAppConfig(): array {
return [];
}
}
11 changes: 7 additions & 4 deletions apps/files_external/tests/Settings/AdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
use OCA\Files_External\Service\BackendService;
use OCA\Files_External\Service\GlobalStoragesService;
use OCA\Files_External\Settings\Admin;
use OCP\App\IAppManager;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\Encryption\IManager;
use OCP\IL10N;
use OCP\IURLGenerator;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
Expand All @@ -27,7 +27,7 @@ class AdminTest extends TestCase {
private GlobalAuth&MockObject $globalAuth;
private IInitialState&MockObject $initialState;
private IURLGenerator&MockObject $urlGenerator;
private IAppManager&MockObject $appManager;
private IL10N&MockObject $l10n;
private Admin $admin;

protected function setUp(): void {
Expand All @@ -38,7 +38,10 @@ protected function setUp(): void {
$this->globalAuth = $this->createMock(GlobalAuth::class);
$this->initialState = $this->createMock(IInitialState::class);
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->appManager = $this->createMock(IAppManager::class);
$this->l10n = $this->createMock(IL10N::class);
$this->l10n->method('t')->willReturnCallback(function ($text) {
return $text;
});

$this->admin = new Admin(
$this->encryptionManager,
Expand All @@ -47,7 +50,7 @@ protected function setUp(): void {
$this->globalAuth,
$this->initialState,
$this->urlGenerator,
$this->appManager,
$this->l10n,
);
}

Expand Down