test: adjust tests for updated local backend check

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2026-05-19 15:26:05 +02:00
parent 4166a20a6d
commit 8e2ef53117
No known key found for this signature in database
GPG key ID: 42B69D8A64526EFB
3 changed files with 15 additions and 2 deletions

View file

@ -50,7 +50,7 @@ class GlobalStoragesControllerTest extends StoragesControllerTestCase {
$session,
$this->createMock(IGroupManager::class),
$config,
$this->createMock(BackendService::class),
$this->backendService,
);
}

View file

@ -13,9 +13,11 @@ use OCA\Files_External\Controller\UserStoragesController;
use OCA\Files_External\Lib\Auth\AuthMechanism;
use OCA\Files_External\Lib\Auth\NullMechanism;
use OCA\Files_External\Lib\Backend\Backend;
use OCA\Files_External\Lib\Backend\Local;
use OCA\Files_External\Lib\Backend\SMB;
use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\NotFoundException;
use OCA\Files_External\Service\BackendService;
use OCA\Files_External\Service\GlobalStoragesService;
use OCA\Files_External\Service\UserStoragesService;
use OCP\AppFramework\Http;
@ -24,9 +26,20 @@ use PHPUnit\Framework\MockObject\MockObject;
abstract class StoragesControllerTestCase extends \Test\TestCase {
protected GlobalStoragesController|UserStoragesController $controller;
protected GlobalStoragesService|UserStoragesService|MockObject $service;
protected BackendService|MockObject $backendService;
protected function setUp(): void {
parent::setUp();
$this->backendService = $this->createMock(BackendService::class);
$this->backendService->method('getBackend')
->willReturnCallback(function ($identifier) {
if ($identifier === 'local') {
return $this->createMock(Local::class);
} else {
return $this->createMock(Backend::class);
}
});
}
protected function tearDown(): void {

View file

@ -59,7 +59,7 @@ class UserStoragesControllerTest extends StoragesControllerTestCase {
$session,
$this->createMock(IGroupManager::class),
$config,
$this->createMock(BackendService::class),
$this->backendService,
);
}