Craft

Type
Class
Namespace
craft\test
Inherits
craft\test\Craft » Codeception\Module\Yii2
Since
3.2.0

Craft module for codeception

View source (opens new window)

# Public Properties

Property Description
currentTest \Codeception\TestInterface
instance self – The current instance

# currentTest

Type
\Codeception\TestInterface
Default value
null

View source (opens new window)

# instance

Type
self
Default value
null

The current instance

View source (opens new window)

# Protected Properties

Property Description
addedConfig array (opens new window) – Application config file must be set.
requiredEvents array (opens new window) – For expecting events code
triggeredEvents array (opens new window) – For expecting events code

# addedConfig

Type
array (opens new window)
Default value
[ 'migrations' => [], 'plugins' => [], 'dbSetup' => null, 'projectConfig' => null, 'fullMock' => false, 'edition' => \Craft::Solo, ]

Application config file must be set.

View source (opens new window)

# requiredEvents

Type
array (opens new window)
Default value
[]

For expecting events code

View source (opens new window)

# triggeredEvents

Type
array (opens new window)
Default value
[]

For expecting events code

View source (opens new window)

# Public Methods

# __construct()

Craft constructor.

We need to merge the config settings here as this is the earliest point in the instance's existence. Doing it in _initialize() won't work as the config variables have already been added.

View source (opens new window)

Arguments

# _afterSuite()

View source (opens new window)

# _before()

View source (opens new window)

Arguments

  • $test (\Codeception\TestInterface)

Throws

# _beforeSuite()

View source (opens new window)

Arguments

  • $settings

# _initialize()

View source (opens new window)

# assertElementsExist()

View source (opens new window)

Arguments

Returns

array (opens new window)

# assertEqualDates()

View source (opens new window)

Arguments

Throws

# assertNotPushedToQueue()

View source (opens new window)

Arguments

# assertPushedToQueue()

View source (opens new window)

Arguments

# assertTestFails()

View source (opens new window)

Arguments

# createDbConfig()

Creates a DB config according to the loaded .env variables.

View source (opens new window)

Returns

craft\config\DbConfig

# createEventItems()

View source (opens new window)

Arguments

Returns

array (opens new window)

# deleteElement()

View source (opens new window)

Arguments

Returns

boolean (opens new window)

Throws

# expectEvent()

Ensure that an event is triggered by the $callback() function.

View source (opens new window)

Arguments

# getCodeceptionName()

View source (opens new window)

Returns

string (opens new window)

# getFieldLayoutByFieldHandle()

View source (opens new window)

Arguments

Returns

craft\models\FieldLayout, null (opens new window)

# installPlugin()

View source (opens new window)

Arguments

Throws

# mockCraftMethods()

View source (opens new window)

Arguments

Throws

# mockDbMethods()

Since
3.6.11

View source (opens new window)

Arguments

# mockMethods()

View source (opens new window)

Arguments

Throws

# normalizePathSeparators()

View source (opens new window)

Arguments

  • $path (mixed)

Returns

string (opens new window), false (opens new window)

# resetProjectConfig()

Since
3.3.10

Reset's the project config.

View source (opens new window)

Arguments

  • $force (boolean (opens new window)) – Whether to force the reset. If set to true the reset key of the projectConfig configuration will be ignored and the project config will be reset regardless.

Returns

boolean (opens new window)

# runQueue()

An easy way of handling the testing of queue jobs.

View source (opens new window)

Arguments

Throws

# saveElement()

View source (opens new window)

Arguments

Returns

boolean (opens new window)

Throws

# setupDb()

View source (opens new window)

Throws

# Protected Methods

# addModule()

View source (opens new window)

Arguments

Throws

# mockModulesAndPlugins()

View source (opens new window)

Arguments

  • $test (\Codeception\PHPUnit\TestCase)

Throws

# recreateClient()

View source (opens new window)

# validateEventValue()

View source (opens new window)

Arguments