Skip to content

Commit 25df337

Browse files
icewind1991backportbot[bot]
authored andcommitted
test: adjust tests for updated local backend check
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 60fd2a7 commit 25df337

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

apps/files_external/tests/Controller/GlobalStoragesControllerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ private function createController(bool $allowCreateLocal = true): GlobalStorages
4949
$this->createMock(LoggerInterface::class),
5050
$session,
5151
$this->createMock(IGroupManager::class),
52-
$config
52+
$config,
53+
$this->backendService,
5354
);
5455
}
5556

apps/files_external/tests/Controller/StoragesControllerTestCase.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313
use OCA\Files_External\Lib\Auth\AuthMechanism;
1414
use OCA\Files_External\Lib\Auth\NullMechanism;
1515
use OCA\Files_External\Lib\Backend\Backend;
16+
use OCA\Files_External\Lib\Backend\Local;
1617
use OCA\Files_External\Lib\Backend\SMB;
1718
use OCA\Files_External\Lib\StorageConfig;
1819
use OCA\Files_External\MountConfig;
1920
use OCA\Files_External\NotFoundException;
21+
use OCA\Files_External\Service\BackendService;
2022
use OCA\Files_External\Service\GlobalStoragesService;
2123
use OCA\Files_External\Service\UserStoragesService;
2224
use OCP\AppFramework\Http;
@@ -25,10 +27,21 @@
2527
abstract class StoragesControllerTestCase extends \Test\TestCase {
2628
protected GlobalStoragesController|UserStoragesController $controller;
2729
protected GlobalStoragesService|UserStoragesService|MockObject $service;
30+
protected BackendService|MockObject $backendService;
2831

2932
protected function setUp(): void {
3033
parent::setUp();
3134
MountConfig::$skipTest = true;
35+
36+
$this->backendService = $this->createMock(BackendService::class);
37+
$this->backendService->method('getBackend')
38+
->willReturnCallback(function ($identifier) {
39+
if ($identifier === 'local') {
40+
return $this->createMock(Local::class);
41+
} else {
42+
return $this->createMock(Backend::class);
43+
}
44+
});
3245
}
3346

3447
protected function tearDown(): void {

apps/files_external/tests/Controller/UserStoragesControllerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ private function createController(bool $allowCreateLocal = true) {
5858
$this->createMock(LoggerInterface::class),
5959
$session,
6060
$this->createMock(IGroupManager::class),
61-
$config
61+
$config,
62+
$this->backendService,
6263
);
6364
}
6465

0 commit comments

Comments
 (0)