@@ -1305,6 +1305,8 @@ public static function dataGetShares(): array {
13051305 $ file1EmailShareOwnerExpected ,
13061306 $ file1CircleShareOwnerExpected ,
13071307 $ file1RoomShareOwnerExpected ,
1308+ $ file1RemoteShareOwnerExpected ,
1309+ $ file1RemoteGroupShareOwnerExpected ,
13081310 ]
13091311 ],
13101312 [
@@ -1475,6 +1477,8 @@ public static function dataGetShares(): array {
14751477 $ file1EmailShareOwnerExpected ,
14761478 $ file1CircleShareOwnerExpected ,
14771479 $ file1RoomShareOwnerExpected ,
1480+ $ file1RemoteShareOwnerExpected ,
1481+ $ file1RemoteGroupShareOwnerExpected ,
14781482 ]
14791483 ],
14801484 [
@@ -2169,6 +2173,64 @@ public function testCreateShareGroupNotAllowed(): void {
21692173 $ this ->ocs ->createShare ('valid-path ' , Constants::PERMISSION_ALL , IShare::TYPE_GROUP , 'invalidGroup ' );
21702174 }
21712175
2176+ public function testGetFederatedShareWhenOutgoingFederationDisabled (): void {
2177+ $ share = $ this ->createMock (IShare::class);
2178+ $ share ->method ('getId ' )->willReturn ('42 ' );
2179+ $ share ->method ('getShareType ' )->willReturn (IShare::TYPE_REMOTE );
2180+
2181+ /** @var ShareAPIController&MockObject $ocs */
2182+ $ ocs = $ this ->getMockBuilder (ShareAPIController::class)
2183+ ->setConstructorArgs ([
2184+ $ this ->appName ,
2185+ $ this ->request ,
2186+ $ this ->shareManager ,
2187+ $ this ->groupManager ,
2188+ $ this ->userManager ,
2189+ $ this ->rootFolder ,
2190+ $ this ->urlGenerator ,
2191+ $ this ->l ,
2192+ $ this ->config ,
2193+ $ this ->appConfig ,
2194+ $ this ->appManager ,
2195+ $ this ->serverContainer ,
2196+ $ this ->userStatusManager ,
2197+ $ this ->previewManager ,
2198+ $ this ->dateTimeZone ,
2199+ $ this ->logger ,
2200+ $ this ->factory ,
2201+ $ this ->mailer ,
2202+ $ this ->tagManager ,
2203+ $ this ->trustedServers ,
2204+ $ this ->currentUser ,
2205+ ])
2206+ ->onlyMethods (['canAccessShare ' , 'formatShare ' ])
2207+ ->getMock ();
2208+
2209+ $ ocs ->method ('canAccessShare ' )->willReturn (true );
2210+ $ ocs ->method ('formatShare ' )->with ($ share )->willReturn ([
2211+ 'id ' => '42 ' ,
2212+ 'share_type ' => IShare::TYPE_REMOTE ,
2213+ ]);
2214+
2215+ $ this ->shareManager
2216+ ->method ('getShareById ' )
2217+ ->willReturnCallback (function (string $ id , string $ recipient ) use ($ share ) {
2218+ $ this ->assertSame ($ this ->currentUser , $ recipient );
2219+ if ($ id === 'ocFederatedSharing:42 ' ) {
2220+ return $ share ;
2221+ }
2222+
2223+ throw new ShareNotFound ();
2224+ });
2225+
2226+ $ this ->assertSame ([
2227+ [
2228+ 'id ' => '42 ' ,
2229+ 'share_type ' => IShare::TYPE_REMOTE ,
2230+ ],
2231+ ], $ ocs ->getShare ('42 ' )->getData ());
2232+ }
2233+
21722234
21732235 public function testCreateShareLinkNoLinksAllowed (): void {
21742236 $ this ->expectException (OCSNotFoundException::class);
0 commit comments