@@ -168,16 +168,42 @@ protected function getUserMock(string $uid): IUser {
168168
169169 public static function dataFileCreate (): array {
170170 return [
171- ['user ' , 'created_self ' , 'created_by ' , Files::TYPE_SHARE_CREATED ],
172- ['' , '' , 'created_public ' , Files_Sharing::TYPE_PUBLIC_UPLOAD ],
171+ ['user ' , false , 'created_self ' , 'created_by ' , Files::TYPE_SHARE_CREATED ],
172+ ['' , true , '' , 'created_public ' , Files_Sharing::TYPE_PUBLIC_UPLOAD ],
173+ ['' , false , 'created_self ' , 'created_by ' , Files::TYPE_SHARE_CREATED ],
173174 ];
174175 }
175176
176177 #[DataProvider('dataFileCreate ' )]
177- public function testFileCreate (string $ currentUser , string $ selfSubject , string $ othersSubject , string $ type ): void {
178- $ filesHooks = $ this ->getFilesHooks ([
179- 'addNotificationsForFileAction ' ,
180- ], $ currentUser );
178+ public function testFileCreate (string $ currentUser , bool $ isPublicShare , string $ selfSubject , string $ othersSubject , string $ type ): void {
179+ $ currentUserMock = $ this ->createMock (CurrentUser::class);
180+ $ currentUserMock ->method ('getUID ' )->willReturn ($ currentUser );
181+ $ currentUserMock ->method ('getUserIdentifier ' )->willReturn ($ currentUser );
182+ $ currentUserMock ->method ('isPublicShareToken ' )->willReturn ($ isPublicShare );
183+
184+ $ logger = $ this ->createMock (LoggerInterface::class);
185+
186+ $ filesHooks = $ this ->getMockBuilder (FilesHooks::class)
187+ ->setConstructorArgs ([
188+ $ this ->activityManager ,
189+ $ this ->data ,
190+ $ this ->settings ,
191+ $ this ->groupManager ,
192+ $ this ->view ,
193+ $ this ->rootFolder ,
194+ $ this ->shareHelper ,
195+ Server::get (IDBConnection::class),
196+ $ this ->urlGenerator ,
197+ $ logger ,
198+ $ currentUserMock ,
199+ $ this ->userMountCache ,
200+ $ this ->config ,
201+ $ this ->notificationGenerator ,
202+ $ this ->tagManager ,
203+ $ this ->teamManager ,
204+ ])
205+ ->onlyMethods (['addNotificationsForFileAction ' ])
206+ ->getMock ();
181207
182208 $ filesHooks ->expects ($ this ->once ())
183209 ->method ('addNotificationsForFileAction ' )
0 commit comments