diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2017-04-11 16:35:46 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2017-04-11 16:35:46 +0200 |
commit | 3600dd4f5295b67eaad3cbd503675e9bd9c679aa (patch) | |
tree | 56b33722ac6ae7cdb9b56d053633884c9e49739d /tests/lib | |
parent | bd6273ee1c803b8a129fb76135ca23377805da9e (diff) | |
download | nextcloud-server-3600dd4f5295b67eaad3cbd503675e9bd9c679aa.tar.gz nextcloud-server-3600dd4f5295b67eaad3cbd503675e9bd9c679aa.zip |
Add IEMailTemplate to public OCP API
Also adds `\OCP\Mail\IMailer::createEMailTemplate` as helper so the functionality can easily be used within apps.
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/Mail/MailerTest.php | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/tests/lib/Mail/MailerTest.php b/tests/lib/Mail/MailerTest.php index 02f7bdc6589..a7226b9ecd6 100644 --- a/tests/lib/Mail/MailerTest.php +++ b/tests/lib/Mail/MailerTest.php @@ -8,32 +8,44 @@ namespace Test\Mail; +use OC\Mail\EMailTemplate; use OC\Mail\Mailer; use OCP\Defaults; use OCP\IConfig; +use OCP\IL10N; use OCP\ILogger; +use OCP\IURLGenerator; use Test\TestCase; class MailerTest extends TestCase { - /** @var IConfig */ + /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */ private $config; - /** @var Defaults */ + /** @var Defaults|\PHPUnit_Framework_MockObject_MockObject */ private $defaults; - /** @var ILogger */ + /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */ private $logger; + /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */ + private $urlGenerator; + /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */ + private $l10n; /** @var Mailer */ private $mailer; - function setUp() { + public function setUp() { parent::setUp(); - $this->config = $this->getMockBuilder('\OCP\IConfig') - ->disableOriginalConstructor()->getMock(); - $this->defaults = $this->getMockBuilder('\OCP\Defaults') - ->disableOriginalConstructor()->getMock(); - $this->logger = $this->getMockBuilder('\OCP\ILogger') - ->disableOriginalConstructor()->getMock(); - $this->mailer = new Mailer($this->config, $this->logger, $this->defaults); + $this->config = $this->createMock(IConfig::class); + $this->defaults = $this->createMock(Defaults::class); + $this->logger = $this->createMock(ILogger::class); + $this->urlGenerator = $this->createMock(IURLGenerator::class); + $this->l10n = $this->createMock(IL10N::class); + $this->mailer = new Mailer( + $this->config, + $this->logger, + $this->defaults, + $this->urlGenerator, + $this->l10n + ); } public function testGetMailInstance() { @@ -120,4 +132,7 @@ class MailerTest extends TestCase { $this->assertSame($expected, $this->mailer->validateMailAddress($email)); } + public function testCreateEMailTemplate() { + $this->assertSame(EMailTemplate::class, get_class($this->mailer->createEMailTemplate())); + } } |