class TestKernel extends CoreKernel (View source)

Kernel for running unit tests

Properties

protected Kernel $nestedFrom from  BaseKernel
protected Injector $container from  BaseKernel
protected string $enviroment from  BaseKernel
protected ClassLoader $classLoader from  BaseKernel
protected ModuleLoader $moduleLoader from  BaseKernel
protected ConfigLoader $configLoader from  BaseKernel
protected InjectorLoader $injectorLoader from  BaseKernel
protected ThemeResourceLoader $themeResourceLoader from  BaseKernel
protected $basePath from  BaseKernel

Methods

public
__construct(string $basePath)

Create a new kernel for this application

protected
bootPHP()

Initialise PHP with default variables

protected
bootManifests(bool $flush)

Boot all manifests

protected
bootConfigs()

Include all _config.php files

protected
bootErrorHandling()

Turn on error handling

public
string
getEnvironment()

Get the environment type

protected
null|string
sessionEnvironment() deprecated

Check or update any temporary environment specified in the session.

public
boot($flush = false)

No description

public
isFlushed()

Returns whether the Kernel has been flushed on boot

protected
detectLegacyEnvironment()

Check if there's a legacy _ss_environment.php file

protected
redirectToInstaller(string $msg = '')

If missing configuration, redirect to install.php if it exists.

protected
array
getIgnoredCIConfigs() deprecated

No description

protected
bool
getIncludeTests()

No description

protected
void
setBooted(bool $bool)

No description

public
shutdown()

Shutdowns the kernel.

public
nest()

Nests this kernel, all components, and returns the nested value.

public
$this
activate()

Ensures this kernel is the active kernel after or during nesting

public
getNestedFrom()

No description

public
getContainer()

No description

public
$this
setInjectorLoader(InjectorLoader $injectorLoader)

No description

public
getInjectorLoader()

Get loader for injector instance

public
getClassLoader()

No description

public
$this
setClassLoader(ClassLoader $classLoader)

No description

public
getModuleLoader()

No description

public
$this
setModuleLoader(ModuleLoader $moduleLoader)

No description

public
$this
setEnvironment(string $environment)

Sets new environment

public
getConfigLoader()

No description

public
$this
setConfigLoader(ConfigLoader $configLoader)

No description

public
$this
setThemeResourceLoader(ThemeResourceLoader $themeResourceLoader)

No description

protected
validateDatabase()

Check that the database configuration is valid, throwing an HTTPResponse_Exception if it's not

protected
bootDatabaseGlobals()

Load default database configuration from the $database and $databaseConfig globals

protected
bootDatabaseEnvVars()

Load default database configuration from environment variable

protected
array
getDatabaseConfig()

Load database config from environment

protected
string
getDatabasePrefix()

No description

protected
string
getDatabaseSuffix()

No description

protected
string
getDatabaseName()

Get name of database

public
$this
reset()

Reset kernel between tests.

public
setIgnoredCIConfigs(array $ciConfigs) deprecated

Set a list of CI configurations that should cause a module's test not to be added to a manifest

Details

__construct(string $basePath)

Create a new kernel for this application

Parameters

string $basePath

Path to base dir for this application

protected bootPHP()

Initialise PHP with default variables

protected bootManifests(bool $flush)

Boot all manifests

Parameters

bool $flush

protected bootConfigs()

Include all _config.php files

protected bootErrorHandling()

Turn on error handling

Exceptions

Exception

string getEnvironment()

Get the environment type

Return Value

string

protected null|string sessionEnvironment() deprecated

deprecated 4.13.0 Will be removed without equivalent functionality to replace it

Check or update any temporary environment specified in the session.

Return Value

null|string

boot($flush = false)

No description

Parameters

$flush

Exceptions

HTTPResponse_Exception
Exception

isFlushed()

Returns whether the Kernel has been flushed on boot

protected detectLegacyEnvironment()

Check if there's a legacy _ss_environment.php file

protected redirectToInstaller(string $msg = '')

If missing configuration, redirect to install.php if it exists.

Otherwise show a server error to the user.

Parameters

string $msg

Optional message to show to the user on an installed project (install.php missing).

protected ManifestCacheFactory buildManifestCacheFactory()

No description

Return Value

ManifestCacheFactory

protected array getIgnoredCIConfigs() deprecated

deprecated 4.12.0 Will be removed without equivalent functionality

No description

Return Value

array

List of CI types to ignore as defined by Module.

protected bool getIncludeTests()

No description

Return Value

bool

protected void setBooted(bool $bool)

No description

Parameters

bool $bool

Return Value

void

shutdown()

Shutdowns the kernel.

Kernel nest()

Nests this kernel, all components, and returns the nested value.

Return Value

Kernel

$this activate()

Ensures this kernel is the active kernel after or during nesting

Return Value

$this

getNestedFrom()

No description

Injector getContainer()

No description

Return Value

Injector

$this setInjectorLoader(InjectorLoader $injectorLoader)

No description

Parameters

InjectorLoader $injectorLoader

Return Value

$this

InjectorLoader getInjectorLoader()

Get loader for injector instance

Return Value

InjectorLoader

ClassLoader getClassLoader()

No description

Return Value

ClassLoader

$this setClassLoader(ClassLoader $classLoader)

No description

Parameters

ClassLoader $classLoader

Return Value

$this

ModuleLoader getModuleLoader()

No description

Return Value

ModuleLoader

$this setModuleLoader(ModuleLoader $moduleLoader)

No description

Parameters

ModuleLoader $moduleLoader

Return Value

$this

$this setEnvironment(string $environment)

Sets new environment

Parameters

string $environment

Return Value

$this

ConfigLoader getConfigLoader()

No description

Return Value

ConfigLoader

$this setConfigLoader(ConfigLoader $configLoader)

No description

Parameters

ConfigLoader $configLoader

Return Value

$this

ThemeResourceLoader getThemeResourceLoader()

No description

Return Value

ThemeResourceLoader

$this setThemeResourceLoader(ThemeResourceLoader $themeResourceLoader)

No description

Parameters

ThemeResourceLoader $themeResourceLoader

Return Value

$this

protected validateDatabase()

Check that the database configuration is valid, throwing an HTTPResponse_Exception if it's not

protected bootDatabaseGlobals()

Load default database configuration from the $database and $databaseConfig globals

protected bootDatabaseEnvVars()

Load default database configuration from environment variable

protected array getDatabaseConfig()

Load database config from environment

Return Value

array

protected string getDatabasePrefix()

No description

Return Value

string

protected string getDatabaseSuffix()

No description

Return Value

string

protected string getDatabaseName()

Get name of database

Return Value

string

$this reset()

Reset kernel between tests.

Note: this avoids resetting services (See TestState for service specific reset)

Return Value

$this

TestKernel setIgnoredCIConfigs(array $ciConfigs) deprecated

deprecated 4.12.0 Will be removed without equivalent functionality

Set a list of CI configurations that should cause a module's test not to be added to a manifest

Parameters

array $ciConfigs

Return Value

TestKernel