@@ -67,6 +67,8 @@ class AttachmentServiceTest extends TestCase {
6767
6868 /** @var IUserManager|MockObject */
6969 private $ userManager ;
70+ /** @var ConfigService */
71+ private $ configService ;
7072 /** @var AttachmentMapper|MockObject */
7173 private $ attachmentMapper ;
7274 /** @var CardMapper|MockObject */
@@ -109,6 +111,8 @@ public function setUp(): void {
109111
110112 $ this ->appContainer = $ this ->createMock (IAppContainer::class);
111113
114+ $ this ->configService = $ this ->createMock (ConfigService::class);
115+
112116 $ this ->userManager = $ this ->createMock (IUserManager::class);
113117 $ this ->attachmentMapper = $ this ->createMock (AttachmentMapper::class);
114118 $ this ->cardMapper = $ this ->createMock (CardMapper::class);
@@ -137,6 +141,7 @@ public function setUp(): void {
137141 $ this ->attachmentServiceValidator = $ this ->createMock (AttachmentServiceValidator::class);
138142
139143 $ this ->attachmentService = new AttachmentService (
144+ $ this ->configService ,
140145 $ this ->attachmentMapper ,
141146 $ this ->cardMapper ,
142147 $ this ->userManager ,
@@ -173,7 +178,7 @@ public function testRegisterAttachmentService() {
173178 $ application ->expects ($ this ->any ())
174179 ->method ('getContainer ' )
175180 ->willReturn ($ appContainer );
176- $ attachmentService = new AttachmentService ($ this ->attachmentMapper , $ this ->cardMapper , $ this ->userManager , $ this ->changeHelper , $ this ->permissionService , $ application , $ this ->attachmentCacheHelper , $ this ->userId , $ this ->l10n , $ this ->activityManager , $ this ->attachmentServiceValidator );
181+ $ attachmentService = new AttachmentService ($ this ->configService , $ this -> attachmentMapper , $ this ->cardMapper , $ this ->userManager , $ this ->changeHelper , $ this ->permissionService , $ application , $ this ->attachmentCacheHelper , $ this ->userId , $ this ->l10n , $ this ->activityManager , $ this ->attachmentServiceValidator );
177182 $ attachmentService ->registerAttachmentService ('custom ' , MyAttachmentService::class);
178183 $ this ->assertEquals ($ fileServiceMock , $ attachmentService ->getService ('deck_file ' ));
179184 $ this ->assertEquals (MyAttachmentService::class, get_class ($ attachmentService ->getService ('custom ' )));
@@ -203,7 +208,7 @@ public function testRegisterAttachmentServiceNotExisting() {
203208 ->method ('getContainer ' )
204209 ->willReturn ($ appContainer );
205210
206- $ attachmentService = new AttachmentService ($ this ->attachmentMapper , $ this ->cardMapper , $ this ->userManager , $ this ->changeHelper , $ this ->permissionService , $ application , $ this ->attachmentCacheHelper , $ this ->userId , $ this ->l10n , $ this ->activityManager , $ this ->attachmentServiceValidator );
211+ $ attachmentService = new AttachmentService ($ this ->configService , $ this -> attachmentMapper , $ this ->cardMapper , $ this ->userManager , $ this ->changeHelper , $ this ->permissionService , $ application , $ this ->attachmentCacheHelper , $ this ->userId , $ this ->l10n , $ this ->activityManager , $ this ->attachmentServiceValidator );
207212 $ attachmentService ->registerAttachmentService ('custom ' , MyAttachmentService::class);
208213 $ attachmentService ->getService ('deck_file_invalid ' );
209214 }
@@ -264,9 +269,12 @@ public function testFindAllWithDeleted() {
264269 ->method ('findAll ' )
265270 ->with (123 )
266271 ->willReturn ($ attachments );
272+ $ this ->configService ->expects ($ this ->once ())
273+ ->method ('getTrashRetention ' )
274+ ->willReturn (3600 );
267275 $ this ->attachmentMapper ->expects ($ this ->once ())
268276 ->method ('findToDelete ' )
269- ->with (123 , false )
277+ ->with ($ this -> anything (), 123 , false )
270278 ->willReturn ($ attachmentsDeleted );
271279
272280 $ this ->attachmentServiceImpl ->expects ($ this ->exactly (4 ))
0 commit comments