facile-it / symfony-functional-testcase
A small functional base test case for Symfony
Package info
github.com/facile-it/symfony-functional-testcase
pkg:composer/facile-it/symfony-functional-testcase
Requires
- php: ^8.1
- symfony/framework-bundle: ^5.4|^6.0|^7.0|^8.0
Requires (Dev)
- facile-it/facile-coding-standard: 1.5.0
- jangregor/phpstan-prophecy: 2.3.0
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: 2.2.1
- phpstan/phpstan-phpunit: 2.0.16
- phpunit/phpunit: ^10.5.63 || ^11.5 || ^12.5 || ^13.0
- rector/rector: 2.4.5
- symfony/browser-kit: ^5.4|^6.0|^7.0|^8.0
- symfony/console: ^5.4|^6.0|^7.0|^8.0
- symfony/monolog-bridge: >=3
- symfony/monolog-bundle: ^3.1.2 || ^4.0-dev
- symfony/phpunit-bridge: ^5.1.8 || ^7.0.0 || ^8.0.0
- symfony/security-bundle: ^5.4|^6.0|^7.0|^8.0
- symfony/security-core: ^5.4|^6.0|^7.0|^8.0
- symfony/yaml: ^5.4|^6.0|^7.0|^8.0
Suggests
- facile-it/paraunit: A PHPUnit wrapper to execute tests in parallel
This package is auto-updated.
Last update: 2026-06-10 09:19:21 UTC
README
This is a small base TestCase for PHPUnit functional tests in Symfony that provides a simple getContainer() helper,
alongside with some small caching to speed up the tests.
Forked (and slimmed down) from liip/LiipFunctionalTestBundle.
Installation
$ composer require --dev facile-it/symfony-functional-testcase
Usage
To use this in one of your functional tests, you just have to edit it like this:
<?php namespace Tests; -use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; +use Facile\SymfonyFunctionalTestCase\WebTestCase; class SomeTest extends WebTestCase {
Functionalities
Check HTTP status codes
isSuccessful()
Check that the request succedded:
$client = $this->makeClient(); $client->request('GET', '/contact'); // Successful HTTP request $this->isSuccessful($client->getResponse());
Add false as the second argument in order to check that the request failed:
$client = $this->makeClient(); $client->request('GET', '/error'); // Request returned an error $this->isSuccessful($client->getResponse(), false);
In order to test more specific status codes, use assertStatusCode():
assertStatusCode()
Check the HTTP status code from the request:
$client = $this->makeClient(); $client->request('GET', '/contact'); // Standard response for successful HTTP request $this->assertStatusCode(302, $client);
Command Tests
TODO document runCommand