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 @@ -50,7 +50,8 @@ private function createController($allowCreateLocal = true) {
5050 $ this ->createMock (LoggerInterface::class),
5151 $ session ,
5252 $ this ->createMock (IGroupManager::class),
53- $ config
53+ $ config ,
54+ $ this ->backendService ,
5455 );
5556 }
5657
Original file line number Diff line number Diff line change 1111use OCA \Files_External \Lib \Auth \AuthMechanism ;
1212use OCA \Files_External \Lib \Backend \Backend ;
1313
14+ use OCA \Files_External \Lib \Backend \Local ;
1415use OCA \Files_External \Lib \StorageConfig ;
1516use OCA \Files_External \NotFoundException ;
17+ use OCA \Files_External \Service \BackendService ;
1618use OCA \Files_External \Service \GlobalStoragesService ;
1719use OCA \Files_External \Service \UserStoragesService ;
1820use OCP \AppFramework \Http ;
@@ -29,9 +31,23 @@ abstract class StoragesControllerTest extends \Test\TestCase {
2931 * @var GlobalStoragesService|UserStoragesService|MockObject
3032 */
3133 protected $ service ;
34+ /**
35+ * @var BackendService|MockObject
36+ */
37+ protected $ backendService ;
3238
3339 protected function setUp (): void {
3440 \OCA \Files_External \MountConfig::$ skipTest = true ;
41+
42+ $ this ->backendService = $ this ->createMock (BackendService::class);
43+ $ this ->backendService ->method ('getBackend ' )
44+ ->willReturnCallback (function ($ identifier ) {
45+ if ($ identifier === 'local ' ) {
46+ return $ this ->createMock (Local::class);
47+ } else {
48+ return $ this ->createMock (Backend::class);
49+ }
50+ });
3551 }
3652
3753 protected function tearDown (): void {
Original file line number Diff line number Diff line change @@ -57,7 +57,8 @@ private function createController($allowCreateLocal = true) {
5757 $ this ->createMock (LoggerInterface::class),
5858 $ session ,
5959 $ this ->createMock (IGroupManager::class),
60- $ config
60+ $ config ,
61+ $ this ->backendService ,
6162 );
6263 }
6364
You can’t perform that action at this time.
0 commit comments