abstract class KernelTestCase extends TestCase

KernelTestCase is the base class for tests needing a Kernel.

Traits

Properties

static protected $class
static protected KernelInterface $kernel

Methods

void
tearDown()

No description

static string
getPhpUnitXmlDir() deprecated

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

static string
getKernelClass()

Attempts to guess the kernel location.

static KernelInterface
bootKernel(array $options = [])

Boots the Kernel for this test.

static KernelInterface
createKernel(array $options = [])

Creates a Kernel.

static 
ensureKernelShutdown()

Shuts the kernel down if it was used in the test - called by the tearDown method by default.

Details

protected void tearDown()

Return Value

void

at line 47
static protected string getPhpUnitXmlDir() deprecated

deprecated since 3.4 and will be removed in 4.0.

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

at line 117
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

at line 163
static protected KernelInterface bootKernel(array $options = [])

Boots the Kernel for this test.

Parameters

array $options

Return Value

KernelInterface A KernelInterface instance

at line 183
static protected KernelInterface createKernel(array $options = [])

Creates a Kernel.

Available options:

  • environment
  • debug

Parameters

array $options

Return Value

KernelInterface A KernelInterface instance

at line 215
static protected ensureKernelShutdown()

Shuts the kernel down if it was used in the test - called by the tearDown method by default.