File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
packages/mailer/src/Testing Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -247,6 +247,12 @@ public function assertSeeInHtml(string $expect): self
247247 */
248248 public function assertNotSeeInHtml (string $ expect ): self
249249 {
250+ if ($ this ->symfonyEmail ->getHtmlBody () === null ) {
251+ Assert::assertNull ($ this ->symfonyEmail ->getHtmlBody ());
252+
253+ return $ this ;
254+ }
255+
250256 Assert::assertStringNotContainsString (
251257 needle: $ expect ,
252258 haystack: $ this ->symfonyEmail ->getHtmlBody (),
@@ -280,6 +286,12 @@ public function assertSeeInText(string $expect): self
280286 */
281287 public function assertNotSeeInText (string $ expect ): self
282288 {
289+ if ($ this ->symfonyEmail ->getTextBody () === null ) {
290+ Assert::assertNull ($ this ->symfonyEmail ->getTextBody ());
291+
292+ return $ this ;
293+ }
294+
283295 Assert::assertStringNotContainsString (
284296 needle: $ expect ,
285297 haystack: $ this ->symfonyEmail ->getTextBody (),
Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ public function test_sent_email_assertions(): void
3131 $ sent ->assertSee ('Hello Jon ' );
3232 $ sent ->assertNotSee ('this is not in the email ' );
3333
34+ $ sent ->assertNotSeeInHtml ('Hello Jon ' );
35+
3436 $ sent ->assertSeeInText ('Hello Jon in Text ' );
3537 $ sent ->assertNotSeeInText ('this is not in the Text ' );
3638
You can’t perform that action at this time.
0 commit comments