abstract class WebTestCase extends KernelTestCase

WebTestCase is the base class for functional tests.

Properties

static protected $class from KernelTestCase
static protected KernelInterface $kernel from KernelTestCase

Methods

static string
getPhpUnitXmlDir()

Finds the directory where the phpunit.xml(.dist) is stored.

static string
getKernelClass()

Attempts to guess the kernel location.

static 
bootKernel(array $options = array())

Boots the Kernel for this test.

static KernelInterface
createKernel(array $options = array())

Creates a Kernel.

static 
ensureKernelShutdown()

Shuts the kernel down if it was used in the test.

tearDown()

Clean up Kernel usage in this test.

static Client
createClient(array $options = array(), array $server = array())

Creates a Client.

Details

in KernelTestCase at line 43
static protected string getPhpUnitXmlDir()

Finds the directory where the phpunit.xml(.dist) is stored.

If you run tests with the PHPUnit CLI tool, everything will work as expected. If not, override this method in your test classes.

Return Value

string The directory where phpunit.xml(.dist) is stored

Exceptions

RuntimeException

in KernelTestCase at line 107
static protected string getKernelClass()

Attempts to guess the kernel location.

When the Kernel is located, the file is required.

Return Value

string The Kernel class name

Exceptions

RuntimeException

in KernelTestCase at line 140
static protected bootKernel(array $options = array())

Boots the Kernel for this test.

Parameters

array $options

in KernelTestCase at line 158
static protected KernelInterface createKernel(array $options = array())

Creates a Kernel.

Available options:

  • environment
  • debug

Parameters

array $options

Return Value

KernelInterface A KernelInterface instance

in KernelTestCase at line 173
static protected ensureKernelShutdown()

Shuts the kernel down if it was used in the test.

in KernelTestCase at line 187
protected tearDown()

Clean up Kernel usage in this test.

at line 31
static protected Client createClient(array $options = array(), array $server = array())

Creates a Client.

Parameters

array $options An array of options to pass to the createKernel method
array $server An array of server parameters

Return Value

Client A Client instance