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