Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5b36f5b

Browse filesBrowse files
committed
Merge branch '4.4' into 5.3
* 4.4: [PHPUnitBridge] [PHPUnit Bridge] Remove the table that lists PHPUnit versions Add functional test chapter to mailer
2 parents e16818e + 6a5a7d7 commit 5b36f5b
Copy full SHA for 5b36f5b

File tree

Expand file treeCollapse file tree

2 files changed

+32
-13
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+32
-13
lines changed

‎components/phpunit_bridge.rst

Copy file name to clipboardExpand all lines: components/phpunit_bridge.rst
+1-13Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -903,18 +903,6 @@ configured by the ``SYMFONY_PHPUNIT_DIR`` env var, or in the same directory as
903903
the ``simple-phpunit`` if it is not provided. It's also possible to set this
904904
env var in the ``phpunit.xml.dist`` file.
905905

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-
918906
If you have installed the bridge through Composer, you can run it by calling e.g.:
919907

920908
.. code-block:: terminal
@@ -923,7 +911,7 @@ If you have installed the bridge through Composer, you can run it by calling e.g
923911
924912
.. tip::
925913

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
927915
``SYMFONY_PHPUNIT_VERSION`` env var in the ``phpunit.xml.dist`` file (e.g.
928916
``<server name="SYMFONY_PHPUNIT_VERSION" value="5.5"/>``). This is the
929917
preferred method as it can be committed to your version control repository.

‎mailer.rst

Copy file name to clipboardExpand all lines: mailer.rst
+31Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,6 +1416,37 @@ a specific address, instead of the *real* address:
14161416
;
14171417
};
14181418
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+
14191450
.. _`high availability`: https://en.wikipedia.org/wiki/High_availability
14201451
.. _`load balancing`: https://en.wikipedia.org/wiki/Load_balancing_(computing)
14211452
.. _`download the foundation-emails.css file`: https://github.com/foundation/foundation-emails/blob/develop/dist/foundation-emails.css

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.