File tree Expand file tree Collapse file tree 2 files changed +32
-13
lines changed
Filter options
Expand file tree Collapse file tree 2 files changed +32
-13
lines changed
Original file line number Diff line number Diff line change @@ -903,18 +903,6 @@ configured by the ``SYMFONY_PHPUNIT_DIR`` env var, or in the same directory as
903
903
the ``simple-phpunit `` if it is not provided. It's also possible to set this
904
904
env var in the ``phpunit.xml.dist `` file.
905
905
906
- By default, these are the PHPUnit versions used depending on the installed PHP versions:
907
-
908
- ===================== ===============================
909
- Installed PHP version PHPUnit version used by default
910
- ===================== ===============================
911
- PHP <= 5.5 PHPUnit 4.8
912
- PHP 5.6 PHPUnit 5.7
913
- PHP 7.0 PHPUnit 6.5
914
- PHP 7.1 PHPUnit 7.5
915
- PHP >= 7.2 PHPUnit 8.3
916
- ===================== ===============================
917
-
918
906
If you have installed the bridge through Composer, you can run it by calling e.g.:
919
907
920
908
.. code-block :: terminal
@@ -923,7 +911,7 @@ If you have installed the bridge through Composer, you can run it by calling e.g
923
911
924
912
.. tip ::
925
913
926
- It's possible to change the base version of PHPUnit by setting the
914
+ It's possible to change the PHPUnit version by setting the
927
915
``SYMFONY_PHPUNIT_VERSION `` env var in the ``phpunit.xml.dist `` file (e.g.
928
916
``<server name="SYMFONY_PHPUNIT_VERSION" value="5.5"/> ``). This is the
929
917
preferred method as it can be committed to your version control repository.
Original file line number Diff line number Diff line change @@ -1416,6 +1416,37 @@ a specific address, instead of the *real* address:
1416
1416
;
1417
1417
};
1418
1418
1419
+ Write a Functional Test
1420
+ ~~~~~~~~~~~~~~~~~~~~~~~
1421
+
1422
+ To functionally test that an email was sent, and even assert the email content or headers,
1423
+ you can use the built in assertions::
1424
+
1425
+ // tests/Controller/MailControllerTest.php
1426
+ namespace App\Tests\Controller;
1427
+
1428
+ use Symfony\Bundle\FrameworkBundle\Test\MailerAssertionsTrait;
1429
+ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
1430
+
1431
+ class MailControllerTest extends WebTestCase
1432
+ {
1433
+ use MailerAssertionsTrait;
1434
+
1435
+ public function testMailIsSentAndContentIsOk()
1436
+ {
1437
+ $client = $this->createClient();
1438
+ $client->request('GET', '/mail/send');
1439
+ $this->assertResponseIsSuccessful();
1440
+
1441
+ $this->assertEmailCount(1);
1442
+
1443
+ $email = $this->getMailerMessage();
1444
+
1445
+ $this->assertEmailHtmlBodyContains($email, 'Welcome');
1446
+ $this->assertEmailTextBodyContains($email, 'Welcome');
1447
+ }
1448
+ }
1449
+
1419
1450
.. _`high availability` : https://en.wikipedia.org/wiki/High_availability
1420
1451
.. _`load balancing` : https://en.wikipedia.org/wiki/Load_balancing_(computing)
1421
1452
.. _`download the foundation-emails.css file` : https://github.com/foundation/foundation-emails/blob/develop/dist/foundation-emails.css
You can’t perform that action at this time.
0 commit comments