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:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2017-08-21 09:34:15 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2017-08-21 09:34:15 +0300
commit663d5714010d2b9f6cc246d3dcc864e60a47736b (patch)
tree98aef2c4f129e533676cb7e8ee53c1a5a0b19675 /tests
parent4552e8b6935683ef4f5b4c4504aa53e98ea12785 (diff)
Fix mail manager test
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests')
-rw-r--r--tests/Service/MailManagerTest.php29
1 files changed, 25 insertions, 4 deletions
diff --git a/tests/Service/MailManagerTest.php b/tests/Service/MailManagerTest.php
index bc6d0c8fb..7cd38be44 100644
--- a/tests/Service/MailManagerTest.php
+++ b/tests/Service/MailManagerTest.php
@@ -24,23 +24,29 @@ namespace OCA\Mail\Tests\Service;
use Horde_Imap_Client_Socket;
use OCA\Mail\Account;
use OCA\Mail\IMAP\IMAPClientFactory;
+use OCA\Mail\IMAP\Sync\Request;
+use OCA\Mail\IMAP\Sync\Synchronizer;
use OCA\Mail\Service\FolderMapper;
use OCA\Mail\Service\FolderNameTranslator;
use OCA\Mail\Service\MailManager;
use OCA\Mail\Tests\TestCase;
use OCP\Files\Folder;
+use PHPUnit_Framework_TestCase;
class MailManagerTest extends TestCase {
- /** @var IMAPClientFactory */
+ /** @var IMAPClientFactory|PHPUnit_Framework_TestCase */
private $imapClientFactory;
- /** @var FolderMapper */
+ /** @var FolderMapper|PHPUnit_Framework_TestCase */
private $folderMapper;
- /** @var FolderNameTranslator */
+ /** @var FolderNameTranslator|PHPUnit_Framework_TestCase */
private $translator;
+ /** @var Synchronizer|PHPUnit_Framework_TestCase */
+ private $sync;
+
/** @varr MailManager */
private $manager;
@@ -50,8 +56,9 @@ class MailManagerTest extends TestCase {
$this->imapClientFactory = $this->createMock(IMAPClientFactory::class);
$this->folderMapper = $this->createMock(FolderMapper::class);
$this->translator = $this->createMock(FolderNameTranslator::class);
+ $this->sync = $this->createMock(Synchronizer::class);
- $this->manager = new MailManager($this->imapClientFactory, $this->folderMapper, $this->translator);
+ $this->manager = new MailManager($this->imapClientFactory, $this->folderMapper, $this->translator, $this->sync);
}
public function testGetFolders() {
@@ -88,4 +95,18 @@ class MailManagerTest extends TestCase {
$this->manager->getFolders($account);
}
+ public function testSync() {
+ $account = $this->createMock(Account::class);
+ $syncRequest = $this->createMock(Request::class);
+ $client = $this->createMock(Horde_Imap_Client_Socket::class);
+ $this->imapClientFactory->expects($this->once())
+ ->method('getClient')
+ ->willReturn($client);
+ $this->sync->expects($this->once())
+ ->method('sync')
+ ->with($client, $syncRequest);
+
+ $this->manager->syncMessages($account, $syncRequest);
+ }
+
}