Warning: You are browsing the documentation for PrestaShop 1.7, which is outdated.
You might want to look at the current version, PrestaShop 8. Read the updated version of the documentation
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.
To create a functional test, we encourage you to base your test class on our own implementation of WebTestCase
.
For instance:
<?php
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();
self::assertTrue($response->isSuccessful());
}
}
Find out more in Symfony’s documentation on functional testing.