September 2016
Intermediate to advanced
1091 pages
21h 41m
English
Before we start writing our functional tests, we need to edit the phpunit.xml.dist file by adding our bundle Tests directory to the testsuite paths, as follows:
<testsuites>
<testsuite name="Project Test Suite">
<-- ... other elements ... -->
<directory>src/AppBundle/Tests</directory>
<-- ... other elements ... -->
</testsuite>
</testsuites>Our functional tests will cover only one controller, since we have no other. We start off by creating a src/AppBundle/Tests/Controller/DefaultControllerTest.php file with content as follows:
namespace AppBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
{
//…
}The next step is to test each and every one of our controller ...
Read now
Unlock full access