Deine Einladung
-Hey , du wurdest von zum Liga-Manager eingeladen.
- Registrieren -
-
-
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
-
-
-
-
- Passwort zurücksetzen-Hey , nutze den folgenden Link um ein neues Passwort zu vergeben. - Neues Passwort setzen - |
-
This is just a test
'); $tester = $this->getCommandTester('app:mail:send'); self::assertExecutionSuccess($tester->execute([ 'recipient' => 'test@example.com', 'subject' => 'Test', - 'html-file' => $htmlFile + 'content' => 'This is just a test' ])); - unlink($htmlFile); } public function testImportingLogo(): string diff --git a/tests/GraphQL/UserTest.php b/tests/GraphQL/UserTest.php index f4eb6296..8ca09c98 100644 --- a/tests/GraphQL/UserTest.php +++ b/tests/GraphQL/UserTest.php @@ -2,6 +2,7 @@ namespace HexagonalPlayground\Tests\GraphQL; +use DOMDocument; use HexagonalPlayground\Domain\User; use HexagonalPlayground\Tests\Framework\DataGenerator; use HexagonalPlayground\Tests\Framework\GraphQL\Exception; @@ -90,6 +91,7 @@ public function testPasswordResetSendsAnEmail() $recipient = current($recipients); self::assertIsObject($recipient); self::assertEquals($user['email'], $recipient->address); + self::assertHtmlMailBodyIsValid($mail->html); } public function testPasswordResetDoesNotErrorWithUnknownEmail(): void @@ -167,6 +169,7 @@ public function testSendingInviteEmail(array $user): array $recipient = current($recipients); self::assertIsObject($recipient); self::assertEquals($user['email'], $recipient->address); + self::assertHtmlMailBodyIsValid($mail->html); return $user; } @@ -205,4 +208,16 @@ public function testUserCanBeDeleted(array $user) $this->expectClientException(); $this->client->getAuthenticatedUser(); } + + /** + * @param string $html + */ + private static function assertHtmlMailBodyIsValid(string $html): void + { + $document = new DOMDocument(); + $document->loadHTML($html); + + self::assertCount(1, $document->getElementsByTagName('title')); + self::assertCount(1, $document->getElementsByTagName('img')); + } }