-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: SebastianKrupinski <[email protected]>
- Loading branch information
1 parent
f5d0792
commit 3dddc78
Showing
2 changed files
with
18 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,42 +15,48 @@ | |
use OCA\Mail\Provider\MailProvider; | ||
use OCA\Mail\Provider\MailService; | ||
use OCA\Mail\Service\AccountService; | ||
use OCP\IL10N; | ||
use OCP\Mail\Provider\Address as MailAddress; | ||
use Psr\Container\ContainerInterface; | ||
use Psr\Log\LoggerInterface; | ||
use Psr\Log\NullLogger; | ||
|
||
class MailProviderTest extends TestCase { | ||
|
||
/** @var ContainerInterfaceMockObject */ | ||
/** @var ContainerInterface&MockObject */ | ||
private $containerInterface; | ||
/** @var AccountServiceMockObject */ | ||
/** @var AccountService&MockObject */ | ||
private $accountService; | ||
/** @var LoggerInterface */ | ||
private $logger; | ||
/** @var IL10N&MockObject */ | ||
private $l10n; | ||
|
||
protected function setUp(): void { | ||
parent::setUp(); | ||
|
||
$this->containerInterface = $this->createMock(ContainerInterface::class); | ||
$this->accountService = $this->createMock(AccountService::class); | ||
$this->logger = new NullLogger(); | ||
$this->l10n = $this->createMock(IL10N::class); | ||
|
||
} | ||
|
||
public function testId(): void { | ||
|
||
// construct mail provider | ||
$mailProvider = new MailProvider($this->containerInterface, $this->accountService, $this->logger); | ||
$mailProvider = new MailProvider($this->containerInterface, $this->accountService, $this->logger, $this->l10n); | ||
// test set by constructor | ||
$this->assertEquals('mail-application', $mailProvider->id()); | ||
|
||
} | ||
|
||
public function testLabel(): void { | ||
|
||
// define l10n return | ||
$this->l10n->expects(self::once())->method('t')->willReturn('Mail Application'); | ||
// construct mail provider | ||
$mailProvider = new MailProvider($this->containerInterface, $this->accountService, $this->logger); | ||
$mailProvider = new MailProvider($this->containerInterface, $this->accountService, $this->logger, $this->l10n); | ||
// test set by constructor | ||
$this->assertEquals('Mail Application', $mailProvider->label()); | ||
|
||
|
@@ -85,7 +91,7 @@ public function testHasServices(): void { | |
) | ||
); | ||
// construct mail provider | ||
$mailProvider = new MailProvider($this->containerInterface, $this->accountService, $this->logger); | ||
$mailProvider = new MailProvider($this->containerInterface, $this->accountService, $this->logger, $this->l10n); | ||
// test result with no services found | ||
$this->assertFalse($mailProvider->hasServices('user0')); | ||
// test result with services found | ||
|
@@ -130,7 +136,7 @@ public function testListServices(): void { | |
) | ||
); | ||
// construct mail provider | ||
$mailProvider = new MailProvider($this->containerInterface, $this->accountService, $this->logger); | ||
$mailProvider = new MailProvider($this->containerInterface, $this->accountService, $this->logger, $this->l10n); | ||
// test result with no services found | ||
$this->assertEquals([], $mailProvider->listServices('user0')); | ||
// test result with services found | ||
|
@@ -175,7 +181,7 @@ public function testFindServiceById(): void { | |
) | ||
); | ||
// construct mail provider | ||
$mailProvider = new MailProvider($this->containerInterface, $this->accountService, $this->logger); | ||
$mailProvider = new MailProvider($this->containerInterface, $this->accountService, $this->logger, $this->l10n); | ||
// test result with no services found | ||
$this->assertEquals(null, $mailProvider->findServiceById('user0', '100')); | ||
// test result with services found | ||
|
@@ -220,7 +226,7 @@ public function testFindServiceByAddress(): void { | |
) | ||
); | ||
// construct mail provider | ||
$mailProvider = new MailProvider($this->containerInterface, $this->accountService, $this->logger); | ||
$mailProvider = new MailProvider($this->containerInterface, $this->accountService, $this->logger, $this->l10n); | ||
// test result with no services found | ||
$this->assertEquals(null, $mailProvider->findServiceByAddress('user0', '[email protected]')); | ||
// test result with services found | ||
|