3.3 Environment & Database
In the previous step you created empty .env
and .env.test
files.
Now fill them with the required variables. The path depends on where your plugin keeps its configuration.
File .env
Case A — config in the root config/
directory
config/
directory###> sylius/test-application ###
SYLIUS_TEST_APP_CONFIGS_TO_IMPORT="@YourPlugin/config/config.yaml"
SYLIUS_TEST_APP_ROUTES_TO_IMPORT="@YourPlugin/config/routes.yaml"
SYLIUS_TEST_APP_BUNDLES_PATH="tests/TestApplication/config/bundles.php"
###< sylius/test-application ###
###> doctrine/doctrine-bundle ###
DATABASE_URL=mysql://root:[email protected]:3306/your_plugin_dev?serverVersion=8.0
###< doctrine/doctrine-bundle ###
Case B — config in src/Resources/config/
src/Resources/config/
###> sylius/test-application ###
SYLIUS_TEST_APP_CONFIGS_TO_IMPORT="../../../../tests/TestApplication/config/config.yaml"
SYLIUS_TEST_APP_ROUTES_TO_IMPORT="../../../../tests/TestApplication/config/routes.yaml"
SYLIUS_TEST_APP_BUNDLES_PATH="tests/TestApplication/config/bundles.php"
###< sylius/test-application ###
###> doctrine/doctrine-bundle ###
DATABASE_URL=mysql://root:[email protected]:3306/your_plugin_%kernel.environment%?serverVersion=8.0
###< doctrine/doctrine-bundle ###
File .env.test
Same as .env
, but point to a test database:
###> sylius/test-application ###
# Use the correct path (Case A or Case B)
SYLIUS_TEST_APP_CONFIGS_TO_IMPORT="@YourPlugin/config/config.yaml"
SYLIUS_TEST_APP_ROUTES_TO_IMPORT="@YourPlugin/config/routes.yaml"
SYLIUS_TEST_APP_BUNDLES_PATH="tests/TestApplication/config/bundles.php"
###< sylius/test-application ###
Quick verification
vendor/bin/console doctrine:database:create --if-not-exists
Last updated
Was this helpful?