@@ -78,6 +78,7 @@ class FilesHooksTest extends TestCase {
7878 * @var (OCA\Circles\CirclesManager&MockObject)|null
7979 */
8080 protected $ teamManager ;
81+ private LoggerInterface &MockObject $ logger ;
8182
8283 protected function setUp (): void {
8384 parent ::setUp ();
@@ -98,6 +99,7 @@ protected function setUp(): void {
9899 $ this ->tagManager ->method ('getUsersFavoritingObject ' )
99100 ->willReturn ([]);
100101 $ this ->teamManager = null ;
102+ $ this ->logger = $ this ->createMock (LoggerInterface::class);
101103
102104 $ this ->tagManager ->method ('load ' )
103105 ->willReturn ($ this ->tags );
@@ -118,8 +120,6 @@ protected function getFilesHooks(array $mockedMethods = [], string $user = 'user
118120 $ currentUser ->expects ($ this ->any ())
119121 ->method ('getUserIdentifier ' )
120122 ->willReturn ($ user );
121- /** @var LoggerInterface $logger */
122- $ logger = $ this ->createMock (LoggerInterface::class);
123123
124124 if (!empty ($ mockedMethods )) {
125125 return $ this ->getMockBuilder (FilesHooks::class)
@@ -133,7 +133,7 @@ protected function getFilesHooks(array $mockedMethods = [], string $user = 'user
133133 $ this ->shareHelper ,
134134 \OCP \Server::get (IDBConnection::class),
135135 $ this ->urlGenerator ,
136- $ logger ,
136+ $ this -> logger ,
137137 $ currentUser ,
138138 $ this ->userMountCache ,
139139 $ this ->config ,
@@ -155,7 +155,7 @@ protected function getFilesHooks(array $mockedMethods = [], string $user = 'user
155155 $ this ->shareHelper ,
156156 \OCP \Server::get (IDBConnection::class),
157157 $ this ->urlGenerator ,
158- $ logger ,
158+ $ this -> logger ,
159159 $ currentUser ,
160160 $ this ->userMountCache ,
161161 $ this ->config ,
@@ -917,6 +917,20 @@ public function testShareNotificationForSharer(): void {
917917 self ::invokePrivate ($ filesHooks , 'shareNotificationForSharer ' , ['subject ' , 'target ' , $ node ]);
918918 }
919919
920+ public function testShareNotificationForSharerException (): void {
921+ $ filesHooks = $ this ->getFilesHooks (['addNotificationsForUser ' ]);
922+ $ node = $ this ->getNodeMock (42 , '/admin/files/path ' );
923+
924+ $ this ->settings ->expects ($ this ->never ())
925+ ->method ('getUserSetting ' );
926+ $ filesHooks ->expects ($ this ->never ())
927+ ->method ('addNotificationsForUser ' );
928+ $ this ->logger ->expects ($ this ->once ())
929+ ->method ('warning ' );
930+
931+ self ::invokePrivate ($ filesHooks , 'shareNotificationForSharer ' , ['subject ' , 'target ' , $ node ]);
932+ }
933+
920934 public static function dataAddNotificationsForUser (): array {
921935 return [
922936 ['user ' , 'subject ' , ['parameter ' ], 42 , 'path/subpath ' , 'path ' , true , true , false , Files_Sharing::TYPE_SHARED , 'files_sharing ' , false ],
0 commit comments