@@ -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,65 @@ 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 ->getEmailValidatorWithStrictEmailCheck (),
2204+ $ this ->trustedServers ,
2205+ $ this ->currentUser ,
2206+ ])
2207+ ->onlyMethods (['canAccessShare ' , 'formatShare ' ])
2208+ ->getMock ();
2209+
2210+ $ ocs ->method ('canAccessShare ' )->willReturn (true );
2211+ $ ocs ->method ('formatShare ' )->with ($ share )->willReturn ([
2212+ 'id ' => '42 ' ,
2213+ 'share_type ' => IShare::TYPE_REMOTE ,
2214+ ]);
2215+
2216+ $ this ->shareManager
2217+ ->method ('getShareById ' )
2218+ ->willReturnCallback (function (string $ id , string $ recipient ) use ($ share ) {
2219+ $ this ->assertSame ($ this ->currentUser , $ recipient );
2220+ if ($ id === 'ocFederatedSharing:42 ' ) {
2221+ return $ share ;
2222+ }
2223+
2224+ throw new ShareNotFound ();
2225+ });
2226+
2227+ $ this ->assertSame ([
2228+ [
2229+ 'id ' => '42 ' ,
2230+ 'share_type ' => IShare::TYPE_REMOTE ,
2231+ ],
2232+ ], $ ocs ->getShare ('42 ' )->getData ());
2233+ }
2234+
21722235
21732236 public function testCreateShareLinkNoLinksAllowed (): void {
21742237 $ this ->expectException (OCSNotFoundException::class);
0 commit comments