summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2017-05-02 14:12:04 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2017-05-02 14:12:04 +0200
commitb13c741cb3471f4f2df579b81e0bb5ebe56fff95 (patch)
tree9b6c10cc9a61c4dcd3db7f643239eac9722ccb5c /tests/lib
parent94c2f12226ed005fc2a1e9c440ec70346e9c272a (diff)
downloadnextcloud-server-b13c741cb3471f4f2df579b81e0bb5ebe56fff95.tar.gz
nextcloud-server-b13c741cb3471f4f2df579b81e0bb5ebe56fff95.zip
Do not show an email action for contacts with emtpy email addresses
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php b/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php
index 2d82fa5d68e..353c8d6f58f 100644
--- a/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php
+++ b/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php
@@ -79,4 +79,28 @@ class EMailproviderTest extends TestCase {
$this->provider->process($entry);
}
+ public function testProcessEmptyAddress() {
+ $entry = $this->createMock(IEntry::class);
+ $action = $this->createMock(ILinkAction::class);
+ $iconUrl = 'https://example.com/img/actions/icon.svg';
+ $this->urlGenerator->expects($this->once())
+ ->method('imagePath')
+ ->willReturn('img/actions/icon.svg');
+ $this->urlGenerator->expects($this->once())
+ ->method('getAbsoluteURL')
+ ->with('img/actions/icon.svg')
+ ->willReturn($iconUrl);
+ $entry->expects($this->once())
+ ->method('getEMailAddresses')
+ ->willReturn([
+ '',
+ ]);
+ $this->actionFactory->expects($this->never())
+ ->method('newEMailAction');
+ $entry->expects($this->never())
+ ->method('addAction');
+
+ $this->provider->process($entry);
+ }
+
}