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
protected bool $bootDatabase from  CoreKernel

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

public
boot($flush = false)

No description

public
bool|null
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 = '') deprecated

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

protected
bool
getIncludeTests()

No description

protected
void
setBooted(bool $bool)

No description

public
bool
getBooted()

Check whether the kernel has booted or not

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

public
setBootDatabase(bool $bool)

Set whether the database should boot or not.

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.

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

boot($flush = false)

No description

Parameters

$flush

Exceptions

HTTPResponse_Exception
Exception

bool|null isFlushed()

Returns whether the Kernel has been flushed on boot

Return Value

bool|null

null if the kernel hasn't been booted yet

protected detectLegacyEnvironment()

Check if there's a legacy _ss_environment.php file

protected redirectToInstaller(string $msg = '') deprecated

deprecated 5.3.0 Will be removed without equivalent functionality

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 bool getIncludeTests()

No description

Return Value

bool

protected void setBooted(bool $bool)

No description

Parameters

bool $bool

Return Value

void

bool getBooted()

Check whether the kernel has booted or not

Return Value

bool

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

CoreKernel setBootDatabase(bool $bool)

Set whether the database should boot or not.

Parameters

bool $bool

Return Value

CoreKernel

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