Skip to content

Commit 60cd0b4

Browse files
committed
test: adjust tests for updated local backend check
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent bc39561 commit 60cd0b4

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

apps/files_external/tests/Controller/GlobalStoragesControllerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ private function createController($allowCreateLocal = true) {
6868
$this->createMock(LoggerInterface::class),
6969
$session,
7070
$this->createMock(IGroupManager::class),
71-
$config
71+
$config,
72+
$this->backendService,
7273
);
7374
}
7475

apps/files_external/tests/Controller/StoragesControllerTest.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@
3131
use OCA\Files_External\Lib\Auth\AuthMechanism;
3232
use OCA\Files_External\Lib\Backend\Backend;
3333

34+
use OCA\Files_External\Lib\Backend\Local;
35+
use OCA\Files_External\Lib\Backend\SMB;
3436
use OCA\Files_External\Lib\StorageConfig;
3537
use OCA\Files_External\NotFoundException;
38+
use OCA\Files_External\Service\BackendService;
3639
use OCA\Files_External\Service\GlobalStoragesService;
3740
use OCA\Files_External\Service\UserStoragesService;
3841
use OCP\AppFramework\Http;
@@ -49,9 +52,23 @@ abstract class StoragesControllerTest extends \Test\TestCase {
4952
* @var GlobalStoragesService|UserStoragesService|MockObject
5053
*/
5154
protected $service;
55+
/**
56+
* @var BackendService|MockObject
57+
*/
58+
protected $backendService;
5259

5360
protected function setUp(): void {
54-
\OCA\Files_External\MountConfig::$skipTest = true;
61+
MountConfig::$skipTest = true;
62+
63+
$this->backendService = $this->createMock(BackendService::class);
64+
$this->backendService->method('getBackend')
65+
->willReturnCallback(function ($identifier) {
66+
if ($identifier === 'local') {
67+
return $this->createMock(Local::class);
68+
} else {
69+
return $this->createMock(Backend::class);
70+
}
71+
});
5572
}
5673

5774
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
@@ -76,7 +76,8 @@ private function createController($allowCreateLocal = true) {
7676
$this->createMock(LoggerInterface::class),
7777
$session,
7878
$this->createMock(IGroupManager::class),
79-
$config
79+
$config,
80+
$this->backendService,
8081
);
8182
}
8283

0 commit comments

Comments
 (0)