@@ -65,6 +65,8 @@ class AttachmentServiceTest extends TestCase {
6565
6666 /** @var IUserManager|MockObject */
6767 private $ userManager ;
68+ /** @var ConfigService */
69+ private $ configService ;
6870 /** @var AttachmentMapper|MockObject */
6971 private $ attachmentMapper ;
7072 /** @var CardMapper|MockObject */
@@ -107,6 +109,8 @@ public function setUp(): void {
107109
108110 $ this ->appContainer = $ this ->createMock (IAppContainer::class);
109111
112+ $ this ->configService = $ this ->createMock (ConfigService::class);
113+
110114 $ this ->userManager = $ this ->createMock (IUserManager::class);
111115 $ this ->attachmentMapper = $ this ->createMock (AttachmentMapper::class);
112116 $ this ->cardMapper = $ this ->createMock (CardMapper::class);
@@ -135,6 +139,7 @@ public function setUp(): void {
135139 $ this ->attachmentServiceValidator = $ this ->createMock (AttachmentServiceValidator::class);
136140
137141 $ this ->attachmentService = new AttachmentService (
142+ $ this ->configService ,
138143 $ this ->attachmentMapper ,
139144 $ this ->cardMapper ,
140145 $ this ->userManager ,
@@ -171,7 +176,7 @@ public function testRegisterAttachmentService() {
171176 $ application ->expects ($ this ->any ())
172177 ->method ('getContainer ' )
173178 ->willReturn ($ appContainer );
174- $ attachmentService = new AttachmentService ($ this ->attachmentMapper , $ this ->cardMapper , $ this ->userManager , $ this ->changeHelper , $ this ->permissionService , $ application , $ this ->attachmentCacheHelper , $ this ->userId , $ this ->l10n , $ this ->activityManager , $ this ->attachmentServiceValidator );
179+ $ 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 );
175180 $ attachmentService ->registerAttachmentService ('custom ' , MyAttachmentService::class);
176181 $ this ->assertEquals ($ fileServiceMock , $ attachmentService ->getService ('deck_file ' ));
177182 $ this ->assertEquals (MyAttachmentService::class, get_class ($ attachmentService ->getService ('custom ' )));
@@ -201,7 +206,7 @@ public function testRegisterAttachmentServiceNotExisting() {
201206 ->method ('getContainer ' )
202207 ->willReturn ($ appContainer );
203208
204- $ attachmentService = new AttachmentService ($ this ->attachmentMapper , $ this ->cardMapper , $ this ->userManager , $ this ->changeHelper , $ this ->permissionService , $ application , $ this ->attachmentCacheHelper , $ this ->userId , $ this ->l10n , $ this ->activityManager , $ this ->attachmentServiceValidator );
209+ $ 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 );
205210 $ attachmentService ->registerAttachmentService ('custom ' , MyAttachmentService::class);
206211 $ attachmentService ->getService ('deck_file_invalid ' );
207212 }
@@ -262,9 +267,12 @@ public function testFindAllWithDeleted() {
262267 ->method ('findAll ' )
263268 ->with (123 )
264269 ->willReturn ($ attachments );
270+ $ this ->configService ->expects ($ this ->once ())
271+ ->method ('getTrashRetention ' )
272+ ->willReturn (3600 );
265273 $ this ->attachmentMapper ->expects ($ this ->once ())
266274 ->method ('findToDelete ' )
267- ->with (123 , false )
275+ ->with ($ this -> anything (), 123 , false )
268276 ->willReturn ($ attachmentsDeleted );
269277
270278 $ this ->attachmentServiceImpl ->expects ($ this ->exactly (4 ))
0 commit comments