@@ -252,7 +252,7 @@ public function testCreateSendPasswordByMailWithoutEnforcedPasswordProtection()
252
252
);
253
253
}
254
254
255
- public function testCreateSendPasswordByMailWithPasswordAndWithoutEnforcedPasswordProtection () {
255
+ public function testCreateSendPasswordByMailWithPasswordAndWithoutEnforcedPasswordProtectionWithPermanentPassword () {
256
256
$ share = $ this ->getMockBuilder (IShare::class)->getMock ();
257
257
$ share ->expects ($ this ->any ())->method ('getSharedWith ' )->willReturn ('receiver@example.com ' );
258
258
$ share ->expects ($ this ->any ())->method ('getSendPasswordByTalk ' )->willReturn (false );
@@ -285,7 +285,7 @@ public function testCreateSendPasswordByMailWithPasswordAndWithoutEnforcedPasswo
285
285
);
286
286
}
287
287
288
- public function testCreateSendPasswordByMailWithPasswordAndWithoutEnforcedPasswordProtectionWithPermanentPassword () {
288
+ public function testCreateSendPasswordByMailWithPasswordAndWithoutEnforcedPasswordProtectionWithoutPermanentPassword () {
289
289
$ share = $ this ->getMockBuilder (IShare::class)->getMock ();
290
290
$ share ->expects ($ this ->any ())->method ('getSharedWith ' )->willReturn ('receiver@example.com ' );
291
291
$ share ->expects ($ this ->any ())->method ('getSendPasswordByTalk ' )->willReturn (false );
@@ -310,21 +310,16 @@ public function testCreateSendPasswordByMailWithPasswordAndWithoutEnforcedPasswo
310
310
// The given password (but not the autogenerated password) should be
311
311
// mailed to the receiver of the share because permanent passwords are enforced.
312
312
$ this ->shareManager ->expects ($ this ->any ())->method ('shareApiLinkEnforcePassword ' )->willReturn (false );
313
- $ this ->config ->expects ($ this ->once ())->method ('getSystemValue ' )->with ('sharing.enable_mail_link_password_expiration ' )->willReturn (true );
314
- $ this ->settingsManager ->expects ($ this ->any ())->method ('sendPasswordByMail ' )->willReturn (true );
315
313
$ instance ->expects ($ this ->never ())->method ('autoGeneratePassword ' );
316
-
317
- $ message = $ this ->createMock (IMessage::class);
318
- $ message ->expects ($ this ->once ())->method ('setTo ' )->with (['receiver@example.com ' ]);
319
- $ this ->mailer ->expects ($ this ->once ())->method ('createMessage ' )->willReturn ($ message );
320
- $ this ->mailer ->expects ($ this ->once ())->method ('createEMailTemplate ' )->with ('sharebymail.RecipientPasswordNotification ' , [
321
- 'filename ' => 'filename ' ,
322
- 'password ' => 'password ' ,
323
- 'initiator ' => 'owner ' ,
324
- 'initiatorEmail ' => null ,
325
- 'shareWith ' => 'receiver@example.com ' ,
326
- ]);
327
- $ this ->mailer ->expects ($ this ->once ())->method ('send ' );
314
+ $ this ->config ->expects ($ this ->any ())->method ('getSystemValue ' )->withConsecutive (
315
+ ['sharing.enable_mail_link_password_expiration ' ],
316
+ ['sharing.enable_mail_link_password_expiration ' ],
317
+ ['sharing.mail_link_password_expiration_interval ' ]
318
+ )->willReturnOnConsecutiveCalls (
319
+ true ,
320
+ true ,
321
+ 3600
322
+ );
328
323
329
324
$ this ->assertSame ('shareObject ' ,
330
325
$ instance ->create ($ share )
@@ -363,7 +358,7 @@ public function testCreateSendPasswordByMailWithEnforcedPasswordProtectionWithPe
363
358
364
359
// The autogenerated password should be mailed to the receiver of the share because permanent passwords are enforced.
365
360
$ this ->shareManager ->expects ($ this ->any ())->method ('shareApiLinkEnforcePassword ' )->willReturn (true );
366
- $ this ->config ->expects ($ this ->once ())->method ('getSystemValue ' )->with ('sharing.enable_mail_link_password_expiration ' )->willReturn (true );
361
+ $ this ->config ->expects ($ this ->any ())->method ('getSystemValue ' )->with ('sharing.enable_mail_link_password_expiration ' )->willReturn (false );
367
362
$ this ->settingsManager ->expects ($ this ->any ())->method ('sendPasswordByMail ' )->willReturn (true );
368
363
369
364
$ message = $ this ->createMock (IMessage::class);
@@ -408,7 +403,7 @@ public function testCreateSendPasswordByMailWithPasswordAndWithEnforcedPasswordP
408
403
// The given password (but not the autogenerated password) should be
409
404
// mailed to the receiver of the share.
410
405
$ this ->shareManager ->expects ($ this ->any ())->method ('shareApiLinkEnforcePassword ' )->willReturn (true );
411
- $ this ->config ->expects ($ this ->once ())->method ('getSystemValue ' )->with ('sharing.enable_mail_link_password_expiration ' )->willReturn (true );
406
+ $ this ->config ->expects ($ this ->any ())->method ('getSystemValue ' )->with ('sharing.enable_mail_link_password_expiration ' )->willReturn (false );
412
407
$ this ->settingsManager ->expects ($ this ->any ())->method ('sendPasswordByMail ' )->willReturn (true );
413
408
$ instance ->expects ($ this ->never ())->method ('autoGeneratePassword ' );
414
409
@@ -429,7 +424,7 @@ public function testCreateSendPasswordByMailWithPasswordAndWithEnforcedPasswordP
429
424
);
430
425
}
431
426
432
- public function testCreateSendPasswordByTalkWithEnforcedPasswordProtection () {
427
+ public function testCreateSendPasswordByTalkWithEnforcedPasswordProtectionWithPermanentPassword () {
433
428
$ share = $ this ->getMockBuilder (IShare::class)->getMock ();
434
429
$ share ->expects ($ this ->any ())->method ('getSharedWith ' )->willReturn ('receiver@example.com ' );
435
430
$ share ->expects ($ this ->any ())->method ('getSendPasswordByTalk ' )->willReturn (true );
@@ -453,7 +448,7 @@ public function testCreateSendPasswordByTalkWithEnforcedPasswordProtection() {
453
448
454
449
// The autogenerated password should be mailed to the owner of the share.
455
450
$ this ->shareManager ->expects ($ this ->any ())->method ('shareApiLinkEnforcePassword ' )->willReturn (true );
456
- $ this ->config ->expects ($ this ->once ())->method ('getSystemValue ' )->with ('sharing.enable_mail_link_password_expiration ' )->willReturn (false );
451
+ $ this ->config ->expects ($ this ->any ())->method ('getSystemValue ' )->with ('sharing.enable_mail_link_password_expiration ' )->willReturn (false );
457
452
$ this ->settingsManager ->expects ($ this ->any ())->method ('sendPasswordByMail ' )->willReturn (true );
458
453
$ instance ->expects ($ this ->once ())->method ('autoGeneratePassword ' )->with ($ share )->willReturn ('autogeneratedPassword ' );
459
454
0 commit comments