September 2016
Intermediate to advanced
332 pages
6h 20m
English
Our entire module has only two controller classes that we want to test for responses. We want to make sure that the process method of the FlatRateController and DynamicRateController classes are accessible and working.
We will first create an src/Foggyline/ShipmentBundle/Tests/Controller/FlatRateControllerTest.php file, with content as follows:
namespace Foggyline\ShipmentBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class FlatRateControllerTest extends WebTestCase { private $client; private $router; public function setUp() { $this->client = static::createClient(); $this->router = $this->client->getContainer()->get('router'); } public function testProcessAction() { $this->client->request('GET', ...Read now
Unlock full access