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() | |
getMockApp() | |
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)
Returns ​
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
(string)
Returns ​
\PHPUnit\Framework\MockObject\MockObject
getMockApp()
​
Arguments ​
Returns ​
\PHPUnit\Framework\MockObject\MockObject
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
(mixed
)
Throws ​
setupCraftDb()
​
Arguments ​
$connection
(craft\db\Connection)
Throws ​
setupProjectConfig()
​
Arguments ​
$projectConfigFolder
(string) – - 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 |