File tree Expand file tree Collapse file tree
apps/files_external/tests/Controller Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 3131use OCA \Files_External \Lib \Auth \AuthMechanism ;
3232use OCA \Files_External \Lib \Backend \Backend ;
3333
34+ use OCA \Files_External \Lib \Backend \Local ;
3435use OCA \Files_External \Lib \StorageConfig ;
3536use OCA \Files_External \NotFoundException ;
37+ use OCA \Files_External \Service \BackendService ;
3638use OCA \Files_External \Service \GlobalStoragesService ;
3739use OCA \Files_External \Service \UserStoragesService ;
3840use OCP \AppFramework \Http ;
@@ -49,9 +51,23 @@ abstract class StoragesControllerTest extends \Test\TestCase {
4951 * @var GlobalStoragesService|UserStoragesService|MockObject
5052 */
5153 protected $ service ;
54+ /**
55+ * @var BackendService|MockObject
56+ */
57+ protected $ backendService ;
5258
5359 protected function setUp (): void {
5460 \OCA \Files_External \MountConfig::$ skipTest = true ;
61+
62+ $ this ->backendService = $ this ->createMock (BackendService::class);
63+ $ this ->backendService ->method ('getBackend ' )
64+ ->willReturnCallback (function ($ identifier ) {
65+ if ($ identifier === 'local ' ) {
66+ return $ this ->createMock (Local::class);
67+ } else {
68+ return $ this ->createMock (Backend::class);
69+ }
70+ });
5571 }
5672
5773 protected function tearDown (): void {
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments