Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-03-14 17:19:55 +0300
committerRoeland Jago Douma <rullzer@owncloud.com>2016-03-15 09:34:53 +0300
commit3a5e90fa03f11017f01a88be607640e4f7a9f0fa (patch)
tree6c1e8601ba3e1c21373e07bf7706b2fda6a9a84a /tests
parentcf232c4182a582c6109f67633bd1367f97bd634f (diff)
Generate a valid URL for link notification
fixes #23197 * Updated unit test
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/share/MailNotificationsTest.php27
1 files changed, 23 insertions, 4 deletions
diff --git a/tests/lib/share/MailNotificationsTest.php b/tests/lib/share/MailNotificationsTest.php
index 66bec8653fb..8c8ca78f39a 100644
--- a/tests/lib/share/MailNotificationsTest.php
+++ b/tests/lib/share/MailNotificationsTest.php
@@ -25,6 +25,7 @@ use OCP\IUser;
use OCP\Mail\IMailer;
use OCP\ILogger;
use OCP\Defaults;
+use OCP\IURLGenerator;
/**
* Class MailNotificationsTest
@@ -40,6 +41,8 @@ class MailNotificationsTest extends \Test\TestCase {
private $defaults;
/** @var IUser | PHPUnit_Framework_MockObject_MockObject */
private $user;
+ /** @var IURLGenerator | PHPUnit_Framework_MockObject_MockObject */
+ private $urlGenerator;
public function setUp() {
@@ -55,6 +58,7 @@ class MailNotificationsTest extends \Test\TestCase {
->disableOriginalConstructor()->getMock();
$this->user = $this->getMockBuilder('\OCP\IUser')
->disableOriginalConstructor()->getMock();
+ $this->urlGenerator = $this->getMock('\OCP\IURLGenerator');
$this->l10n->expects($this->any())
->method('t')
@@ -116,7 +120,8 @@ class MailNotificationsTest extends \Test\TestCase {
$this->l10n,
$this->mailer,
$this->logger,
- $this->defaults
+ $this->defaults,
+ $this->urlGenerator
);
$this->assertSame([], $mailNotifications->sendLinkShareMail('lukas@owncloud.com', 'MyFile', 'https://owncloud.com/file/?foo=bar', 3600));
@@ -180,7 +185,8 @@ class MailNotificationsTest extends \Test\TestCase {
$this->l10n,
$this->mailer,
$this->logger,
- $this->defaults
+ $this->defaults,
+ $this->urlGenerator
);
$this->assertSame([], $mailNotifications->sendLinkShareMail($to, 'MyFile', 'https://owncloud.com/file/?foo=bar', 3600));
}
@@ -193,7 +199,8 @@ class MailNotificationsTest extends \Test\TestCase {
$this->l10n,
$this->mailer,
$this->logger,
- $this->defaults
+ $this->defaults,
+ $this->urlGenerator
);
$this->assertSame(['lukas@owncloud.com'], $mailNotifications->sendLinkShareMail('lukas@owncloud.com', 'MyFile', 'https://owncloud.com/file/?foo=bar', 3600));
@@ -208,7 +215,9 @@ class MailNotificationsTest extends \Test\TestCase {
$this->l10n,
$this->mailer,
$this->logger,
- $this->defaults]);
+ $this->defaults,
+ $this->urlGenerator
+ ]);
$mailNotifications->method('getItemSharedWithUser')
->withAnyParameters()
@@ -227,6 +236,16 @@ class MailNotificationsTest extends \Test\TestCase {
->method('getDisplayName')
->willReturn('Recipient');
+ $this->urlGenerator->expects($this->once())
+ ->method('linkToRouteAbsolute')
+ ->with(
+ $this->equalTo('files.view.index'),
+ $this->equalTo([
+ 'dir' => '/',
+ 'scrollto' => 'welcome.txt'
+ ])
+ );
+
$recipientList = [$recipient];
$result = $mailNotifications->sendInternalShareMail($recipientList, '3', 'file');
$this->assertSame([], $result);