The Craft module is configured through the
# Config options
projectConfig option instructs the Craft module if and how to set-up Project Config support for your tests. It accepts an object with the following parameters:
- folder (required): What folder the Project Config files must be copied from.
Typically, this is
config/projectstarting from the root of your project. The contents of that folder will be copied into
- reset: Whether Project Config should be reset before each test is run.
If enabled, Craft will reset the Project Config state to what is specified in the
folderparameter. Can safely be disabled if you are not making changes to project config during your tests.
If you are using Project Config for your tests, regular database-backed fixtures for Project Config data (i.e sections) may cause syncing issues. We recommended that you set up your environment using the Project Config support 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. It 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
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’re testing an actual Craft site, this directory cannot be the config directory you use for
the production site. Ensure it’s 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.