@ -252,7 +252,7 @@ class ShareByMailProviderTest extends TestCase {
);
}
public function testCreateSendPasswordByMailWithPasswordAndWithoutEnforcedPasswordProtection() {
public function testCreateSendPasswordByMailWithPasswordAndWithoutEnforcedPasswordProtectionWithPermanentPassword () {
$share = $this->getMockBuilder(IShare::class)->getMock();
$share->expects($this->any())->method('getSharedWith')->willReturn('receiver@example.com');
$share->expects($this->any())->method('getSendPasswordByTalk')->willReturn(false);
@ -285,7 +285,7 @@ class ShareByMailProviderTest extends TestCase {
);
}
public function testCreateSendPasswordByMailWithPasswordAndWithoutEnforcedPasswordProtectionWithPermanentPassword() {
public function testCreateSendPasswordByMailWithPasswordAndWithoutEnforcedPasswordProtectionWithout PermanentPassword() {
$share = $this->getMockBuilder(IShare::class)->getMock();
$share->expects($this->any())->method('getSharedWith')->willReturn('receiver@example.com');
$share->expects($this->any())->method('getSendPasswordByTalk')->willReturn(false);
@ -310,21 +310,16 @@ class ShareByMailProviderTest extends TestCase {
// The given password (but not the autogenerated password) should be
// mailed to the receiver of the share because permanent passwords are enforced.
$this->shareManager->expects($this->any())->method('shareApiLinkEnforcePassword')->willReturn(false);
$this->config->expects($this->once())->method('getSystemValue')->with('sharing.enable_mail_link_password_expiration')->willReturn(true);
$this->settingsManager->expects($this->any())->method('sendPasswordByMail')->willReturn(true);
$instance->expects($this->never())->method('autoGeneratePassword');
$message = $this->createMock(IMessage::class);
$message->expects($this->once())->method('setTo')->with(['receiver@example.com']);
$this->mailer->expects($this->once())->method('createMessage')->willReturn($message);
$this->mailer->expects($this->once())->method('createEMailTemplate')->with('sharebymail.RecipientPasswordNotification', [
'filename' => 'filename',
'password' => 'password',
'initiator' => 'owner',
'initiatorEmail' => null,
'shareWith' => 'receiver@example.com',
]);
$this->mailer->expects($this->once())->method('send');
$this->config->expects($this->any())->method('getSystemValue')->withConsecutive(
['sharing.enable_mail_link_password_expiration'],
['sharing.enable_mail_link_password_expiration'],
['sharing.mail_link_password_expiration_interval']
)->willReturnOnConsecutiveCalls(
true,
true,
3600
);
$this->assertSame('shareObject',
$instance->create($share)
@ -363,7 +358,7 @@ class ShareByMailProviderTest extends TestCase {
// The autogenerated password should be mailed to the receiver of the share because permanent passwords are enforced.
$this->shareManager->expects($this->any())->method('shareApiLinkEnforcePassword')->willReturn(true);
$this->config->expects($this->once ())->method('getSystemValue')->with('sharing.enable_mail_link_password_expiration')->willReturn(tru e);
$this->config->expects($this->any ())->method('getSystemValue')->with('sharing.enable_mail_link_password_expiration')->willReturn(fals e);
$this->settingsManager->expects($this->any())->method('sendPasswordByMail')->willReturn(true);
$message = $this->createMock(IMessage::class);
@ -408,7 +403,7 @@ class ShareByMailProviderTest extends TestCase {
// The given password (but not the autogenerated password) should be
// mailed to the receiver of the share.
$this->shareManager->expects($this->any())->method('shareApiLinkEnforcePassword')->willReturn(true);
$this->config->expects($this->once ())->method('getSystemValue')->with('sharing.enable_mail_link_password_expiration')->willReturn(tru e);
$this->config->expects($this->any ())->method('getSystemValue')->with('sharing.enable_mail_link_password_expiration')->willReturn(fals e);
$this->settingsManager->expects($this->any())->method('sendPasswordByMail')->willReturn(true);
$instance->expects($this->never())->method('autoGeneratePassword');
@ -429,7 +424,7 @@ class ShareByMailProviderTest extends TestCase {
);
}
public function testCreateSendPasswordByTalkWithEnforcedPasswordProtection() {
public function testCreateSendPasswordByTalkWithEnforcedPasswordProtectionWithPermanentPassword () {
$share = $this->getMockBuilder(IShare::class)->getMock();
$share->expects($this->any())->method('getSharedWith')->willReturn('receiver@example.com');
$share->expects($this->any())->method('getSendPasswordByTalk')->willReturn(true);
@ -453,7 +448,7 @@ class ShareByMailProviderTest extends TestCase {
// The autogenerated password should be mailed to the owner of the share.
$this->shareManager->expects($this->any())->method('shareApiLinkEnforcePassword')->willReturn(true);
$this->config->expects($this->once ())->method('getSystemValue')->with('sharing.enable_mail_link_password_expiration')->willReturn(false);
$this->config->expects($this->any ())->method('getSystemValue')->with('sharing.enable_mail_link_password_expiration')->willReturn(false);
$this->settingsManager->expects($this->any())->method('sendPasswordByMail')->willReturn(true);
$instance->expects($this->once())->method('autoGeneratePassword')->with($share)->willReturn('autogeneratedPassword');