mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
test: adjust tests for updated local backend check
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
5420df618d
commit
117feb53cc
3 changed files with 17 additions and 2 deletions
|
|
@ -49,7 +49,8 @@ class GlobalStoragesControllerTest extends StoragesControllerTestCase {
|
|||
$this->createMock(LoggerInterface::class),
|
||||
$session,
|
||||
$this->createMock(IGroupManager::class),
|
||||
$config
|
||||
$config,
|
||||
$this->backendService,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,10 +13,12 @@ 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\MountConfig;
|
||||
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;
|
||||
|
|
@ -25,10 +27,21 @@ 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();
|
||||
MountConfig::$skipTest = true;
|
||||
|
||||
$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 {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@ class UserStoragesControllerTest extends StoragesControllerTestCase {
|
|||
$this->createMock(LoggerInterface::class),
|
||||
$session,
|
||||
$this->createMock(IGroupManager::class),
|
||||
$config
|
||||
$config,
|
||||
$this->backendService,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue