This package is abandoned and no longer maintained. No replacement package was suggested.

A simple helper for Symfony WebTestCase

v0.3.0 2019-10-26 19:11 UTC

This package is auto-updated.

Last update: 2020-06-14 15:38:47 UTC


This class is mostly used with PHPUnit and Symfony with functional tests.

Install & requirements

  • PHP 5.5+
  • Use this dependency only in the require-dev section of your composer.json

Database resetter

If you are using Sqlite as database driver for your tests, you can define the following two constants and use the WebTestCase::resetDatabase() method to reset the database with your database reference.

define('DATABASE_TEST_FILE', $rootDir.'/build/database_test.db');
define('DATABASE_REFERENCE_FILE', $rootDir.'/build/database_reference.db');

This is great because you can create the datatabase first with doctrine:database:create, doctrine:schema:create and maybe import fixtures with doctrine:fixtures:load commands in your PHPUnit bootstrap file.

Create a client in a more friendly way

The method WebTestCase::getClient() allow you to get a Client object with easier access.

Here is the prototype:

function getClient($host = null, array $kernelOptions = [], $tokenRoles = null, array $server = []){}