TestSetup

Type
Class
Namespace
craft\test
Inherits
craft\test\TestSetup
Since
3.2

Class TestSetup.

TestSetup performs various setup tasks required for craft\test\Craft. It is not intended for use within public tests. Use the various features of craft\test\Craft instead.

View source

Public Methods

MethodDescription
appClass()
appType()Determine the app type. If the parent is craft\test\console\ConsoleTest.
cleanseDb()
configureCraft()
createConfigService()
createTestCraftObjectConfig()
getCraftServiceMap()
getMock()
getMockApp()
setupCraftDb()
setupProjectConfig()
tearDownCraft()Taken from the Yii2 Module $i->_after
validateAndApplyMigration()
warmCraft()Creates a craft object to play with. Ensures the Craft::$app service locator is working.

appClass()

View source

Arguments

Returns

string

appType()

Determine the app type. If the parent is craft\test\console\ConsoleTest. Its a console test. Else, web.

View source

Returns

string

cleanseDb()

View source

Arguments

Returns

boolean

Throws

configureCraft()

View source

Returns

boolean

createConfigService()

View source

Returns

craft\services\Config

createTestCraftObjectConfig()

View source

Returns

array

getCraftServiceMap()

View source

Returns

array

getMock()

View source

Arguments

  • $test (\Codeception\PHPUnit\TestCase)
  • $class (string)

Returns

\PHPUnit\Framework\MockObject\MockObject

getMockApp()

View source

Arguments

  • $test (\Codeception\PHPUnit\TestCase)
  • $serviceMap (array)
  • $appClass (string)

Returns

\PHPUnit\Framework\MockObject\MockObject

setupCraftDb()

View source

Arguments

Throws

setupProjectConfig()

View source

Arguments

Throws

tearDownCraft()

Taken from the Yii2 Module $i->_after

View source

validateAndApplyMigration()

View source

Arguments

Returns

false, null

warmCraft()

Creates a craft object to play with. Ensures the Craft::$app service locator is working.

View source

Returns

mixed

Throws