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.
Public Methods ​
Method | Description |
---|---|
appClass() | |
appType() | Determine the app type (console or web). |
cleanseDb() | |
configureCraft() | |
createConfigService() | |
createTestCraftObjectConfig() | |
getCraftServiceMap() | |
getMock() | |
getMockModule() | |
getSeedProjectConfigData() | Returns the data from the project.yml file specified in the codeception.yml file. |
removeProjectConfigFolders() | |
setupCraftDb() | |
setupProjectConfig() | |
tearDownCraft() | Taken from the Yii2 Module $i->_after |
useProjectConfig() | Whether project config should be used in tests. |
validateAndApplyMigration() | |
warmCraft() | Creates a craft object to play with. Ensures the Craft::$app service locator is working. |
appClass()
​
Arguments ​
$preDefinedAppType
(string)
appType()
​
Determine the app type (console or web).
Returns ​
cleanseDb()
​
Arguments ​
$connection
(craft\db\Connection)
Returns ​
Throws ​
configureCraft()
​
Returns ​
createConfigService()
​
Returns ​
createTestCraftObjectConfig()
​
Returns ​
getCraftServiceMap()
​
Returns ​
getMock()
​
Arguments ​
$test
(\Codeception\PHPUnit\TestCase
)$class
(class-string<\craft\test\T>
)
Returns ​
\craft\test\T
, \PHPUnit\Framework\MockObject\MockObject
getMockModule()
​
Arguments ​
$test
(\Codeception\PHPUnit\TestCase
)$serviceMap
(array)$moduleClass
(class-string<\craft\test\T>
, null)
Returns ​
\craft\test\T
getSeedProjectConfigData()
​
Returns the data from the project.yml file specified in the codeception.yml file.
Returns ​
array – The project config in either yaml or as an array.
removeProjectConfigFolders()
​
Arguments ​
$path
(string)
Throws ​
setupCraftDb()
​
Arguments ​
$connection
(craft\db\Connection)
Throws ​
setupProjectConfig()
​
Arguments ​
$projectConfigFolder
(string, null) – - Whether to override the folder specified in codeception.yml with a custom folder.
Throws ​
tearDownCraft()
​
Taken from the Yii2 Module $i->_after
useProjectConfig()
​
Whether project config should be used in tests.
Returns the projectConfig configuration array if yes - false
if not.
Returns ​
validateAndApplyMigration()
​
Arguments ​
Returns ​
Throws ​
warmCraft()
​
Creates a craft object to play with. Ensures the Craft::$app service locator is working.
Returns ​
mixed
Throws ​
Constants ​
Constant | Description |
---|---|
SITE_URL | |
USERNAME |