From 01e9c22695a3e495f07ab445750221af72e09fe4 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Wed, 5 Sep 2018 13:40:03 +0200 Subject: Implemented mailing abstraction Closes #434 --- tests/Unit/Mail/EngelsystemMailerTest.php | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/Unit/Mail/EngelsystemMailerTest.php (limited to 'tests/Unit/Mail/EngelsystemMailerTest.php') diff --git a/tests/Unit/Mail/EngelsystemMailerTest.php b/tests/Unit/Mail/EngelsystemMailerTest.php new file mode 100644 index 00000000..aae6e267 --- /dev/null +++ b/tests/Unit/Mail/EngelsystemMailerTest.php @@ -0,0 +1,40 @@ +createMock(Renderer::class); + /** @var SwiftMailer|MockObject $swiftMailer */ + $swiftMailer = $this->createMock(SwiftMailer::class); + /** @var EngelsystemMailer|MockObject $mailer */ + $mailer = $this->getMockBuilder(EngelsystemMailer::class) + ->setConstructorArgs(['mailer' => $swiftMailer, 'view' => $view]) + ->setMethods(['send']) + ->getMock(); + $mailer->expects($this->once()) + ->method('send') + ->with('foo@bar.baz', 'Lorem dolor', 'Rendered Stuff!') + ->willReturn(1); + $view->expects($this->once()) + ->method('render') + ->with('test/template.tpl', ['dev' => true]) + ->willReturn('Rendered Stuff!'); + + $return = $mailer->sendView('foo@bar.baz', 'Lorem dolor', 'test/template.tpl', ['dev' => true]); + $this->equalTo(1, $return); + } +} -- cgit v1.2.3-54-g00ecf