feat: markdown in email body for mailing and transactional
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Service\Teamer;
|
||||
|
||||
use App\Email\MailBodyRenderer;
|
||||
use App\Email\Mailer;
|
||||
use App\Entity\Teamer;
|
||||
use App\Entity\User;
|
||||
@@ -30,9 +31,12 @@ class TeamerMailingServiceTest extends TestCase
|
||||
$this->teamerRepository = $this->createMock(TeamerRepository::class);
|
||||
$this->mailer = $this->createMock(Mailer::class);
|
||||
|
||||
// The real renderer, not a mock: what the mailing puts in front of a teamer is
|
||||
// Markdown turned into HTML, and getting that wrong is the whole risk here.
|
||||
$this->service = new TeamerMailingService(
|
||||
$this->teamerRepository,
|
||||
$this->mailer,
|
||||
new MailBodyRenderer(),
|
||||
$this->createMock(LoggerInterface::class),
|
||||
'mailing',
|
||||
);
|
||||
@@ -111,7 +115,7 @@ class TeamerMailingServiceTest extends TestCase
|
||||
->expects($this->exactly(2))
|
||||
->method('createAndSendEmail')
|
||||
->willReturnCallback(function (array $context, array $options) use (&$sent): void {
|
||||
$sent[] = [$options['to'], $options['subject'], $context['message']];
|
||||
$sent[] = [$options['to'], $options['subject'], $context['bodyHtml']];
|
||||
})
|
||||
;
|
||||
|
||||
@@ -123,8 +127,8 @@ class TeamerMailingServiceTest extends TestCase
|
||||
));
|
||||
|
||||
$this->assertSame([
|
||||
['[email protected]', 'Hallo Anna', 'Servus Anna Berg'],
|
||||
['[email protected]', 'Hallo Bea', 'Servus Bea Ohm'],
|
||||
['[email protected]', 'Hallo Anna', '<p>Servus Anna Berg</p>'],
|
||||
['[email protected]', 'Hallo Bea', '<p>Servus Bea Ohm</p>'],
|
||||
], $sent);
|
||||
}
|
||||
|
||||
@@ -210,7 +214,7 @@ class TeamerMailingServiceTest extends TestCase
|
||||
->expects($this->once())
|
||||
->method('createAndSendEmail')
|
||||
->with(
|
||||
['message' => 'Servus Rita Kern'],
|
||||
['bodyHtml' => '<p>Servus Rita Kern</p>'],
|
||||
$this->callback(function (array $options): bool {
|
||||
$this->assertSame('[email protected]', $options['to']);
|
||||
$this->assertSame('[Vorschau] Hallo Rita', $options['subject']);
|
||||
|
||||
Reference in New Issue
Block a user