summaryrefslogtreecommitdiffstats
path: root/tests/lib/Share20
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-07-26 23:53:07 +0200
committerMorris Jobke <hey@morrisjobke.de>2017-07-28 08:36:11 +0200
commitc43abe43b07370467cc80e8af2936df2b533aa06 (patch)
tree99871d207c5b2912246585cfea4cf5ede71a35a8 /tests/lib/Share20
parent50b355fa84b3e8fd8e5826b2bf45dd0d3182d64f (diff)
downloadnextcloud-server-c43abe43b07370467cc80e8af2936df2b533aa06.tar.gz
nextcloud-server-c43abe43b07370467cc80e8af2936df2b533aa06.zip
Send an email once a file/folder is shared with a user
* only if user has set an email address * only for user shares (no group shares for now) Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'tests/lib/Share20')
-rw-r--r--tests/lib/Share20/ManagerTest.php47
1 files changed, 40 insertions, 7 deletions
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php
index a764350c406..01d594de7ae 100644
--- a/tests/lib/Share20/ManagerTest.php
+++ b/tests/lib/Share20/ManagerTest.php
@@ -23,6 +23,7 @@ namespace Test\Share20;
use OC\Files\Mount\MoveableMount;
use OC\HintException;
use OC\Share20\DefaultShareProvider;
+use OCP\Defaults;
use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\IRootFolder;
@@ -31,8 +32,10 @@ use OCP\Files\Node;
use OCP\Files\Storage;
use OCP\IGroup;
use OCP\IServerContainer;
+use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserManager;
+use OCP\Mail\IMailer;
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IProviderFactory;
use OCP\Share\IShare;
@@ -85,6 +88,12 @@ class ManagerTest extends \Test\TestCase {
protected $rootFolder;
/** @var EventDispatcher | \PHPUnit_Framework_MockObject_MockObject */
protected $eventDispatcher;
+ /** @var IMailer|\PHPUnit_Framework_MockObject_MockObject */
+ protected $mailer;
+ /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
+ protected $urlGenerator;
+ /** @var \OC_Defaults|\PHPUnit_Framework_MockObject_MockObject */
+ protected $defaults;
public function setUp() {
@@ -97,6 +106,9 @@ class ManagerTest extends \Test\TestCase {
$this->userManager = $this->createMock(IUserManager::class);
$this->rootFolder = $this->createMock(IRootFolder::class);
$this->eventDispatcher = $this->createMock(EventDispatcher::class);
+ $this->mailer = $this->createMock(IMailer::class);
+ $this->urlGenerator = $this->createMock(IURLGenerator::class);
+ $this->defaults = $this->createMock(\OC_Defaults::class);
$this->l = $this->createMock(IL10N::class);
$this->l->method('t')
@@ -117,7 +129,10 @@ class ManagerTest extends \Test\TestCase {
$this->factory,
$this->userManager,
$this->rootFolder,
- $this->eventDispatcher
+ $this->eventDispatcher,
+ $this->mailer,
+ $this->urlGenerator,
+ $this->defaults
);
$this->defaultProvider = $this->createMock(DefaultShareProvider::class);
@@ -141,7 +156,10 @@ class ManagerTest extends \Test\TestCase {
$this->factory,
$this->userManager,
$this->rootFolder,
- $this->eventDispatcher
+ $this->eventDispatcher,
+ $this->mailer,
+ $this->urlGenerator,
+ $this->defaults
]);
}
@@ -2108,7 +2126,10 @@ class ManagerTest extends \Test\TestCase {
$factory,
$this->userManager,
$this->rootFolder,
- $this->eventDispatcher
+ $this->eventDispatcher,
+ $this->mailer,
+ $this->urlGenerator,
+ $this->defaults
);
$share = $this->createMock(IShare::class);
@@ -2147,7 +2168,10 @@ class ManagerTest extends \Test\TestCase {
$factory,
$this->userManager,
$this->rootFolder,
- $this->eventDispatcher
+ $this->eventDispatcher,
+ $this->mailer,
+ $this->urlGenerator,
+ $this->defaults
);
$share = $this->createMock(IShare::class);
@@ -2795,7 +2819,10 @@ class ManagerTest extends \Test\TestCase {
$factory,
$this->userManager,
$this->rootFolder,
- $this->eventDispatcher
+ $this->eventDispatcher,
+ $this->mailer,
+ $this->urlGenerator,
+ $this->defaults
);
$this->assertSame($expected,
$manager->shareProviderExists($shareType)
@@ -2823,7 +2850,10 @@ class ManagerTest extends \Test\TestCase {
$factory,
$this->userManager,
$this->rootFolder,
- $this->eventDispatcher
+ $this->eventDispatcher,
+ $this->mailer,
+ $this->urlGenerator,
+ $this->defaults
);
$factory->setProvider($this->defaultProvider);
@@ -2882,7 +2912,10 @@ class ManagerTest extends \Test\TestCase {
$factory,
$this->userManager,
$this->rootFolder,
- $this->eventDispatcher
+ $this->eventDispatcher,
+ $this->mailer,
+ $this->urlGenerator,
+ $this->defaults
);
$factory->setProvider($this->defaultProvider);