Skip to content

Commit 356693c

Browse files
Update MailerAssertionsTrait.php: Adding Mailpit
I will add a link to Mailpit, as soon as Codeception/codeception.github.com#880 is merged.
1 parent 5e042f1 commit 356693c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/Codeception/Module/Symfony/MailerAssertionsTrait.php

+9-4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function assertQueuedEmailCount(int $count, ?string $transport = null, st
5050
/**
5151
* Checks that no email was sent.
5252
* The check is based on `\Symfony\Component\Mailer\EventListener\MessageLoggerListener`, which means:
53-
* If your app performs an HTTP redirect, you need to suppress it using [stopFollowingRedirects()](https://codeception.com/docs/modules/Symfony#stopFollowingRedirects) first; otherwise this check will *always* pass.
53+
* If your app performs an HTTP redirect, you need to suppress it using [stopFollowingRedirects()](#stopFollowingRedirects) first; otherwise this check will *always* pass.
5454
*/
5555
public function dontSeeEmailIsSent(): void
5656
{
@@ -60,7 +60,7 @@ public function dontSeeEmailIsSent(): void
6060
/**
6161
* Returns the last sent email.
6262
* The function is based on `\Symfony\Component\Mailer\EventListener\MessageLoggerListener`, which means:
63-
* If your app performs an HTTP redirect after sending the email, you need to suppress it using [stopFollowingRedirects()](https://codeception.com/docs/modules/Symfony#stopFollowingRedirects) first.
63+
* If your app performs an HTTP redirect after sending the email, you need to suppress it using [stopFollowingRedirects()](#stopFollowingRedirects) first.
6464
* See also: [grabSentEmails()](https://codeception.com/docs/modules/Symfony#grabSentEmails)
6565
*
6666
* ```php
@@ -82,7 +82,7 @@ public function grabLastSentEmail(): ?Email
8282
/**
8383
* Returns an array of all sent emails.
8484
* The function is based on `\Symfony\Component\Mailer\EventListener\MessageLoggerListener`, which means:
85-
* If your app performs an HTTP redirect after sending the email, you need to suppress it using [stopFollowingRedirects()](https://codeception.com/docs/modules/Symfony#stopFollowingRedirects) first.
85+
* If your app performs an HTTP redirect after sending the email, you need to suppress it using [stopFollowingRedirects()](#stopFollowingRedirects) first.
8686
* See also: [grabLastSentEmail()](https://codeception.com/docs/modules/Symfony#grabLastSentEmail)
8787
*
8888
* ```php
@@ -100,7 +100,12 @@ public function grabSentEmails(): array
100100
/**
101101
* Checks if the given number of emails was sent (default `$expectedCount`: 1).
102102
* The check is based on `\Symfony\Component\Mailer\EventListener\MessageLoggerListener`, which means:
103-
* If your app performs an HTTP redirect after sending the email, you need to suppress it using [stopFollowingRedirects()](https://codeception.com/docs/modules/Symfony#stopFollowingRedirects) first.
103+
* If your app performs an HTTP redirect after sending the email, you need to suppress it using [stopFollowingRedirects()](#stopFollowingRedirects) first.
104+
*
105+
* Limitation:
106+
* If your mail is sent in a Symfony console command and you start that command in your test with [$I->runShellCommand()](https://codeception.com/docs/modules/Cli#runShellCommand),
107+
* Codeception will not notice it.
108+
* As a more professional alternative, we recommend Mailpit, wchich also lets you test the content of the mail.
104109
*
105110
* ```php
106111
* <?php

0 commit comments

Comments
 (0)