September 2016
Intermediate to advanced
1091 pages
21h 41m
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