HumHub Documentation (unofficial)

Yii2 extends AbstractBrowser
in package
uses PhpSuperGlobalsConverter

Table of Contents

Constants

CLEAN_CLEAR  = 'clear'
Clean the response object by resetting specific properties via its' `clear()` method.
CLEAN_FORCE_RECREATE  = 'force_recreate'
Same as recreate but will not warn when behaviors / event handlers are lost.
CLEAN_MANUAL  = 'manual'
Do not clean the response, instead the test writer will be responsible for manually resetting the response in between requests during one test
CLEAN_METHODS  = [self::CLEAN_RECREATE, self::CLEAN_CLEAR, self::CLEAN_FORCE_RECREATE, self::CLEAN_MANUAL]
CLEAN_RECREATE  = 'recreate'
Clean the response object by recreating it.

Properties

$applicationClass  : string
$closeSessionOnRecreateApplication  : bool
$configFile  : string
$recreateApplication  : bool
This option is there primarily for backwards compatibility.
$recreateComponents  : array<string|int, string>
$requestCleanMethod  : string
$responseCleanMethod  : string
$emails  : mixed

Methods

doRequest()  : Response
getApplication()  : Application
getContext()  : array<string|int, mixed>
Return an assoc array with the client context: cookieJar, history.
removeContext()  : mixed
Reset the client context: empty cookieJar and history.
resetApplication()  : mixed
restart()  : mixed
setContext()  : mixed
Set the context, see getContext().
startApp()  : mixed
beforeRequest()  : mixed
Called before each request, preparation happens here.
encodeCookies()  : mixed
Encodes the cookies and adds them to the headers.
mockMailer()  : array<string|int, mixed>
Replace mailer with in memory mailer
remapFiles()  : array<string|int, mixed>
Rearrange files array to be compatible with PHP $_FILES superglobal structure
remapRequestParameters()  : array<string|int, mixed>
Escape high-level variable name with dots, underscores and other "special" chars to be compatible with PHP "bug"
resetRequest()  : mixed
resetResponse()  : mixed
Resets the applications' response object.
revertErrorHandler()  : mixed
getDomainRegex()  : string
Getting domain regex from rule host template
rearrangeFiles()  : mixed
replaceSpaces()  : array<string|int, mixed>
Replace spaces and dots and other chars in high-level query parameters for compatibility with PHP bug (or not a bug)

Constants

CLEAN_CLEAR

Clean the response object by resetting specific properties via its' `clear()` method.

public mixed CLEAN_CLEAR = 'clear'

This will keep behaviors / event handlers, but could inadvertently leave some changes intact.

Tags
see
Response::clear()

CLEAN_FORCE_RECREATE

Same as recreate but will not warn when behaviors / event handlers are lost.

public mixed CLEAN_FORCE_RECREATE = 'force_recreate'

CLEAN_MANUAL

Do not clean the response, instead the test writer will be responsible for manually resetting the response in between requests during one test

public mixed CLEAN_MANUAL = 'manual'

CLEAN_METHODS

public mixed CLEAN_METHODS = [self::CLEAN_RECREATE, self::CLEAN_CLEAR, self::CLEAN_FORCE_RECREATE, self::CLEAN_MANUAL]

CLEAN_RECREATE

Clean the response object by recreating it.

public mixed CLEAN_RECREATE = 'recreate'

This might lose behaviors / event handlers / other changes that are done in the application bootstrap phase.

Properties

$applicationClass

public string $applicationClass = null

The FQN of the application class to use. In a default Yii setup, should be either yii\web\Application or yii\console\Application

$closeSessionOnRecreateApplication

public bool $closeSessionOnRecreateApplication = true

whether to close the session in between requests inside a single test, if recreateApplication is set to true

$configFile

public string $configFile

application config file

$recreateApplication

This option is there primarily for backwards compatibility.

public bool $recreateApplication = false

It means you cannot make any modification to application state inside your app, since they will get discarded.

whether to recreate the whole application before each request

$recreateComponents

public array<string|int, string> $recreateComponents = []

List of component names that must be recreated before each request

$requestCleanMethod

public string $requestCleanMethod

method for cleaning the request object before each request

$responseCleanMethod

public string $responseCleanMethod

method for cleaning the response object before each request

$emails

private mixed $emails = []

Methods

getApplication()

public getApplication() : Application
Tags
deprecated

since 2.5, will become protected in 3.0. Directly access to \Yii::$app if you need to interact with it.

Return values
Application

getContext()

Return an assoc array with the client context: cookieJar, history.

public getContext() : array<string|int, mixed>
Return values
array<string|int, mixed>

removeContext()

Reset the client context: empty cookieJar and history.

public removeContext() : mixed

resetApplication()

public resetApplication([bool $closeSession = true ]) : mixed
Parameters
$closeSession : bool = true

restart()

public restart() : mixed

setContext()

Set the context, see getContext().

public setContext(array<string|int, mixed> $context) : mixed
Parameters
$context : array<string|int, mixed>

startApp()

public startApp() : mixed

beforeRequest()

Called before each request, preparation happens here.

protected beforeRequest() : mixed

mockMailer()

Replace mailer with in memory mailer

protected mockMailer(array<string|int, mixed> $config) : array<string|int, mixed>
Parameters
$config : array<string|int, mixed>

Original configuration

Return values
array<string|int, mixed>

New configuration

remapFiles()

Rearrange files array to be compatible with PHP $_FILES superglobal structure

protected remapFiles(array<string|int, mixed> $requestFiles) : array<string|int, mixed>
Parameters
$requestFiles : array<string|int, mixed>
Tags
see
https://bugs.php.net/bug.php?id=25589
Return values
array<string|int, mixed>

remapRequestParameters()

Escape high-level variable name with dots, underscores and other "special" chars to be compatible with PHP "bug"

protected remapRequestParameters(array<string|int, mixed> $parameters) : array<string|int, mixed>
Parameters
$parameters : array<string|int, mixed>
Tags
see
https://bugs.php.net/bug.php?id=40000
Return values
array<string|int, mixed>

resetResponse()

Resets the applications' response object.

protected resetResponse(Application $app) : mixed

The method used depends on the module configuration.

Parameters
$app : Application

revertErrorHandler()

protected revertErrorHandler() : mixed

getDomainRegex()

Getting domain regex from rule host template

private getDomainRegex(string $template) : string
Parameters
$template : string
Return values
string

replaceSpaces()

Replace spaces and dots and other chars in high-level query parameters for compatibility with PHP bug (or not a bug)

private replaceSpaces(array<string|int, mixed> $parameters) : array<string|int, mixed>
Parameters
$parameters : array<string|int, mixed>

Array of request parameters to be converted

Tags
see
https://bugs.php.net/bug.php?id=40000
Return values
array<string|int, mixed>

        
On this page

Search results