Notice: You are browsing the documentation for PrestaShop 8, which is currently in development.

You might want to read the documentation for the current version, PrestaShop 1.7.

How to create your own symfony controller tests or add tests to PrestaShop

If you create your own Modern (symfony) controllers or if you plan on migrating a legacy controller, you can create tests to cover parts of HTTP layer aka symfony functional tests.

Creating a functional test

To create a functional test, we encourage you to base your test class on our own implementation of WebTestCase.

For instance:

namespace Tests\Functional\Foo;

use Tests\Integration\PrestaShopBundle\Test\WebTestCase;

class BarTest extends WebTestCase
    public function testSomeAction()
        $url = this->router->generate('route_name');
        $this->client->request('GET', $url);
        $response = $this->client->getResponse();

Find out more in Symfony’s documentation on functional testing.