The Craft module is configured through the
The Craft module inherits all configuration options from the Yii2 codeception module (opens new window). All its configuration options (opens new window) are thus also available to use and not explained here.
# Config options
setupDb parameter controls how the database is setup before tests. It accepts an object with the following parameters.
- file (Required): What file the project config setting must be copied from. This is not the
CRAFT_CONFIG_PATHbut instead the file whose contents will be copied into the
project.ymlfile located here.
- reset: Whether the project config should be reset before each test is run. If enabled Craft will reset the project config to what is specified in the
project.ymlfile located in
CRAFT_CONFIG_PATH. Can safely be disabled if you are not making changes to project config during your tests.
If you have enabled
projectConfig, regular DB based fixtures for Project Config data (i.e sections) may cause syncing issues. It is recommended to setup your environment using the
project.yml file only.
migrations parameter accepts an Array of objects with the following parameters.
- class (Required): The migration class
- params: Any parameters that must be passed into the migration.
Migrations will be applied before any tests are run.
plugins parameter accepts an Array of objects with the following parameters.
- class (Required): The main plugin class
- handle (Required): The plugin handle
Plugins will be installed before any tests are run.
setupDb parameter controls how the database is setup before tests. The
projectConfig setting accepts an object with the following parameters:
- clean: Whether all tables should be deleted before any tests.
- setupCraft: Whether the
Install.phpmigration should be run before any tests.
- applyMigrations: Whether migrations stored in
CRAFT_MIGRATIONS_PATHshould be applied before any tests are run.
Determines what edition Craft must be in when running your tests and what is returned when calling
Craft::$app->getEdition(). Note if
projectConfig is enabled the
edition property will be ignored. To set an edition you must define the desired edition in the
# PHP Constants
Additionally, you will have to define several PHP Constants for the test suite to use. All of these constants must be defined in the
The storage path Craft can use during testing.
The templates path Craft can use during testing.
The config path Craft can use during testing.
If you are testing an actual Craft site this directory cannot be the config directory you use for the production site. Ensure it is located within the
The path to the folder where all your migration classes are stored.
The path to the folder where all your translations are stored.
Path to the vendor directory.