September 2016
Intermediate to advanced
332 pages
6h 20m
English
Our module has two controller classes that we want to test for responses. We want to make sure that the authorize, capture, and cancel methods of the CardController and CheckMoneyController classes are working.
We first create asrc/Foggyline/PaymentBundle/Tests/Controller/CardControllerTest.php file, with content as follows:
namespace Foggyline\PaymentBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class CardControllerTest extends WebTestCase { private $client; private $router; public function setUp() { $this->client = static::createClient(); $this->router = $this->client->getContainer()->get('router'); } public function testAuthorizeAction() { $this->client->request('GET', $this->router->generate('foggyline_payment_card_authorize')); ...Read now
Unlock full access