diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2017-08-21 09:34:15 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2017-08-21 09:34:15 +0300 |
commit | 663d5714010d2b9f6cc246d3dcc864e60a47736b (patch) | |
tree | 98aef2c4f129e533676cb7e8ee53c1a5a0b19675 /tests | |
parent | 4552e8b6935683ef4f5b4c4504aa53e98ea12785 (diff) |
Fix mail manager test
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Service/MailManagerTest.php | 29 |
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); + } + } |