@@ -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 */
@@ -106,6 +108,8 @@ public function setUp(): void {
106108
107109 $ this ->appContainer = $ this ->createMock (ContainerInterface::class);
108110
111+ $ this ->configService = $ this ->createMock (ConfigService::class);
112+
109113 $ this ->userManager = $ this ->createMock (IUserManager::class);
110114 $ this ->attachmentMapper = $ this ->createMock (AttachmentMapper::class);
111115 $ this ->cardMapper = $ this ->createMock (CardMapper::class);
@@ -130,6 +134,7 @@ public function setUp(): void {
130134 $ this ->attachmentServiceValidator = $ this ->createMock (AttachmentServiceValidator::class);
131135
132136 $ this ->attachmentService = new AttachmentService (
137+ $ this ->configService ,
133138 $ this ->attachmentMapper ,
134139 $ this ->cardMapper ,
135140 $ this ->userManager ,
@@ -166,7 +171,7 @@ public function testRegisterAttachmentService() {
166171 $ application ->expects ($ this ->any ())
167172 ->method ('getContainer ' )
168173 ->willReturn ($ appContainer );
169- $ attachmentService = new AttachmentService ($ this ->attachmentMapper , $ this ->cardMapper , $ this ->userManager , $ this ->changeHelper , $ this ->permissionService , $ application , $ this ->attachmentCacheHelper , $ this ->userId , $ this ->l10n , $ this ->activityManager , $ this ->attachmentServiceValidator );
174+ $ 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 );
170175 $ attachmentService ->registerAttachmentService ('custom ' , MyAttachmentService::class);
171176 $ this ->assertEquals ($ fileServiceMock , $ attachmentService ->getService ('deck_file ' ));
172177 $ this ->assertEquals (MyAttachmentService::class, get_class ($ attachmentService ->getService ('custom ' )));
@@ -191,7 +196,7 @@ public function testRegisterAttachmentServiceNotExisting() {
191196 ->method ('getContainer ' )
192197 ->willReturn ($ appContainer );
193198
194- $ attachmentService = new AttachmentService ($ this ->attachmentMapper , $ this ->cardMapper , $ this ->userManager , $ this ->changeHelper , $ this ->permissionService , $ application , $ this ->attachmentCacheHelper , $ this ->userId , $ this ->l10n , $ this ->activityManager , $ this ->attachmentServiceValidator );
199+ $ 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 );
195200 $ attachmentService ->registerAttachmentService ('custom ' , MyAttachmentService::class);
196201 $ attachmentService ->getService ('deck_file_invalid ' );
197202 }
@@ -252,9 +257,12 @@ public function testFindAllWithDeleted() {
252257 ->method ('findAll ' )
253258 ->with (123 )
254259 ->willReturn ($ attachments );
260+ $ this ->configService ->expects ($ this ->once ())
261+ ->method ('getTrashRetention ' )
262+ ->willReturn (3600 );
255263 $ this ->attachmentMapper ->expects ($ this ->once ())
256264 ->method ('findToDelete ' )
257- ->with (123 , false )
265+ ->with ($ this -> anything (), 123 , false )
258266 ->willReturn ($ attachmentsDeleted );
259267
260268 $ this ->attachmentServiceImpl ->expects ($ this ->exactly (4 ))
0 commit comments