@@ -252,7 +252,7 @@ public function testCreateSendPasswordByMailWithoutEnforcedPasswordProtection()
252252 );
253253 }
254254
255- public function testCreateSendPasswordByMailWithPasswordAndWithoutEnforcedPasswordProtection () {
255+ public function testCreateSendPasswordByMailWithPasswordAndWithoutEnforcedPasswordProtectionWithPermanentPassword () {
256256 $ share = $ this ->getMockBuilder (IShare::class)->getMock ();
257257 $ share->
expects (
$ this ->
any ())->
method (
'getSharedWith ' )->
willReturn (
'[email protected] ' );
258258 $ share ->expects ($ this ->any ())->method ('getSendPasswordByTalk ' )->willReturn (false );
@@ -285,7 +285,7 @@ public function testCreateSendPasswordByMailWithPasswordAndWithoutEnforcedPasswo
285285 );
286286 }
287287
288- public function testCreateSendPasswordByMailWithPasswordAndWithoutEnforcedPasswordProtectionWithPermanentPassword () {
288+ public function testCreateSendPasswordByMailWithPasswordAndWithoutEnforcedPasswordProtectionWithoutPermanentPassword () {
289289 $ share = $ this ->getMockBuilder (IShare::class)->getMock ();
290290 $ share->
expects (
$ this ->
any ())->
method (
'getSharedWith ' )->
willReturn (
'[email protected] ' );
291291 $ share ->expects ($ this ->any ())->method ('getSendPasswordByTalk ' )->willReturn (false );
@@ -310,21 +310,16 @@ public function testCreateSendPasswordByMailWithPasswordAndWithoutEnforcedPasswo
310310 // The given password (but not the autogenerated password) should be
311311 // mailed to the receiver of the share because permanent passwords are enforced.
312312 $ 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 );
315313 $ instance ->expects ($ this ->never ())->method ('autoGeneratePassword ' );
316-
317- $ message = $ this ->createMock (IMessage::class);
318- $ message->
expects (
$ this ->
once ())->
method (
'setTo ' )->
with ([
'[email protected] ' ]);
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 ' =>
'[email protected] ' ,
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+ );
328323
329324 $ this ->assertSame ('shareObject ' ,
330325 $ instance ->create ($ share )
@@ -363,7 +358,7 @@ public function testCreateSendPasswordByMailWithEnforcedPasswordProtectionWithPe
363358
364359 // The autogenerated password should be mailed to the receiver of the share because permanent passwords are enforced.
365360 $ 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 );
367362 $ this ->settingsManager ->expects ($ this ->any ())->method ('sendPasswordByMail ' )->willReturn (true );
368363
369364 $ message = $ this ->createMock (IMessage::class);
@@ -408,7 +403,7 @@ public function testCreateSendPasswordByMailWithPasswordAndWithEnforcedPasswordP
408403 // The given password (but not the autogenerated password) should be
409404 // mailed to the receiver of the share.
410405 $ 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 );
412407 $ this ->settingsManager ->expects ($ this ->any ())->method ('sendPasswordByMail ' )->willReturn (true );
413408 $ instance ->expects ($ this ->never ())->method ('autoGeneratePassword ' );
414409
@@ -429,7 +424,7 @@ public function testCreateSendPasswordByMailWithPasswordAndWithEnforcedPasswordP
429424 );
430425 }
431426
432- public function testCreateSendPasswordByTalkWithEnforcedPasswordProtection () {
427+ public function testCreateSendPasswordByTalkWithEnforcedPasswordProtectionWithPermanentPassword () {
433428 $ share = $ this ->getMockBuilder (IShare::class)->getMock ();
434429 $ share->
expects (
$ this ->
any ())->
method (
'getSharedWith ' )->
willReturn (
'[email protected] ' );
435430 $ share ->expects ($ this ->any ())->method ('getSendPasswordByTalk ' )->willReturn (true );
@@ -453,7 +448,7 @@ public function testCreateSendPasswordByTalkWithEnforcedPasswordProtection() {
453448
454449 // The autogenerated password should be mailed to the owner of the share.
455450 $ 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 );
457452 $ this ->settingsManager ->expects ($ this ->any ())->method ('sendPasswordByMail ' )->willReturn (true );
458453 $ instance ->expects ($ this ->once ())->method ('autoGeneratePassword ' )->with ($ share )->willReturn ('autogeneratedPassword ' );
459454
0 commit comments