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

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAnna Larch <anna@nextcloud.com>2021-09-16 21:53:49 +0300
committerAnna Larch <anna@nextcloud.com>2021-09-17 13:33:26 +0300
commitc023e097b41e536a13771f557b449ebd27c1a1fd (patch)
treea22391d1c206ba371d19dbaa0eac3c661cca91ff /tests
parent409980e4bff96a486c060c6bb87ed0eb2b31fffb (diff)
Add tags for provisioned users
Signed-off-by: Anna Larch <anna@nextcloud.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/Unit/Service/Provisioning/ManagerTest.php23
-rw-r--r--tests/psalm-baseline.xml17
2 files changed, 25 insertions, 15 deletions
diff --git a/tests/Unit/Service/Provisioning/ManagerTest.php b/tests/Unit/Service/Provisioning/ManagerTest.php
index 2b2dd9449..3b36f9839 100644
--- a/tests/Unit/Service/Provisioning/ManagerTest.php
+++ b/tests/Unit/Service/Provisioning/ManagerTest.php
@@ -67,7 +67,7 @@ class ManagerTest extends TestCase {
$config->setProvisioningDomain('batman.com');
$config->setEmailTemplate('%USER%@batman.com');
$configs = [$config];
- $account = $this->createMock(MailAccount::class);
+ $account = new MailAccount();
$this->mock->getParameter('mailAccountMapper')
->expects($this->once())
->method('findProvisionedAccount')
@@ -86,6 +86,7 @@ class ManagerTest extends TestCase {
$user = $this->createConfiguredMock(IUser::class, [
'getEmailAddress' => 'bruce.wayne@batman.com'
]);
+ $account = new MailAccount();
$config = new Provisioning();
$config->setId(1);
$config->setProvisioningDomain('batman.com');
@@ -97,7 +98,12 @@ class ManagerTest extends TestCase {
->willThrowException($this->createMock(DoesNotExistException::class));
$this->mock->getParameter('mailAccountMapper')
->expects($this->once())
- ->method('insert');
+ ->method('insert')
+ ->willReturn($account);
+ $this->mock->getParameter('tagMapper')
+ ->expects($this->once())
+ ->method('createDefaultTags')
+ ->with($account);
$result = $this->manager->provisionSingleUser($configs, $user);
$this->assertTrue($result);
@@ -108,6 +114,7 @@ class ManagerTest extends TestCase {
$user = $this->createConfiguredMock(IUser::class, [
'getEmailAddress' => 'bruce.wayne@batman.com'
]);
+ $account = new MailAccount();
$config = new Provisioning();
$config->setId(1);
$config->setProvisioningDomain('*');
@@ -132,6 +139,7 @@ class ManagerTest extends TestCase {
$user = $this->createConfiguredMock(IUser::class, [
'getEmailAddress' => 'bruce.wayne@batman.com'
]);
+ $account = new MailAccount();
$config = new Provisioning();
$config->setId(1);
$config->setProvisioningDomain('*');
@@ -143,7 +151,12 @@ class ManagerTest extends TestCase {
->willThrowException($this->createMock(DoesNotExistException::class));
$this->mock->getParameter('mailAccountMapper')
->expects($this->once())
- ->method('insert');
+ ->method('insert')
+ ->willReturn($account);
+ $this->mock->getParameter('tagMapper')
+ ->expects($this->once())
+ ->method('createDefaultTags')
+ ->with($account);
$result = $this->manager->provisionSingleUser($configs, $user);
$this->assertTrue($result);
@@ -154,6 +167,7 @@ class ManagerTest extends TestCase {
$user = $this->createConfiguredMock(IUser::class, [
'getEmailAddress' => 'bruce.wayne@batman.com'
]);
+ $account = new MailAccount();
$config = new Provisioning();
$config->setId(1);
$config->setProvisioningDomain('arkham-asylum.com');
@@ -168,6 +182,9 @@ class ManagerTest extends TestCase {
$this->mock->getParameter('mailAccountMapper')
->expects($this->never())
->method('insert');
+ $this->mock->getParameter('tagMapper')
+ ->expects($this->never())
+ ->method('createDefaultTags');
$result = $this->manager->provisionSingleUser($configs, $user);
$this->assertFalse($result);
diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml
index 19d2f3e35..da9f432f9 100644
--- a/tests/psalm-baseline.xml
+++ b/tests/psalm-baseline.xml
@@ -35,6 +35,11 @@
<code>get</code>
</TooManyArguments>
</file>
+ <file src="lib/Command/AddMissingTags.php">
+ <UndefinedClass occurrences="1">
+ <code>Command</code>
+ </UndefinedClass>
+ </file>
<file src="lib/Command/CleanUp.php">
<UndefinedClass occurrences="1">
<code>Command</code>
@@ -278,11 +283,6 @@
<code>UserDeletedListener</code>
</MissingDependency>
</file>
- <file src="lib/Service/AntiSpamService.php">
- <MissingDependency occurrences="1">
- <code>MessageFlaggedEvent</code>
- </MissingDependency>
- </file>
<file src="lib/Service/Classification/ImportanceClassifier.php">
<InvalidScalarArgument occurrences="1">
<code>$predictedValidationLabel</code>
@@ -293,13 +293,6 @@
<code>$this-&gt;contactsManager-&gt;getUserAddressBooks()</code>
</UndefinedDocblockClass>
</file>
- <file src="lib/Service/HtmlPurify/TransformURLScheme.php">
- <NullArgument occurrences="3">
- <code>null</code>
- <code>null</code>
- <code>null</code>
- </NullArgument>
- </file>
<file src="lib/Service/MailManager.php">
<MissingDependency occurrences="8">
<code>BeforeMessageDeletedEvent</code>