3.5 Configuration

Open tests/TestApplication/config/config.yaml and import your plugin configuration files. The import path depends on where your plugin keeps its config directory.

Example configuration

  1. If your plugin has config/ in the root directory:

imports:
  - { resource: "@YourPlugin/config/config.yaml" }
# old structure
#  - { resource: "@YourPlugin/Resources/config/config.yaml" }

What to do if there is no single main config file:

Sometimes a plugin does not provide one main configuration file. In that case, you have two options:

a) Create a main config.yaml in your plugin root config/ directory, which imports all other configuration files:

imports:
  - { resource: 'routes.yaml' }
  - { resource: 'other_config.yaml' }

b) Import all configuration files directly in your application (instead of a single main file):

imports:
  - { resource: "@YourPlugin/config/routes.yaml" }
  - { resource: "@YourPlugin/config/other_config.yaml" }
  1. You can also import local service definitions if needed:

imports:
  - { resource: "services.yaml" }
  - { resource: "services_test.php" }
  1. Only add doctrine mapping if you have custom entities.

# Use type: attribute for modern Doctrine attributes or type: xml for XML mapping
doctrine:
    orm:
        entity_managers:
            default:
                mappings:
                    TestApp:
                        is_bundle: false
                        type: attribute  # or 'xml' for XML mapping
                        dir: '%kernel.project_dir%/../../../tests/TestApplication/src/Entity'  # for attributes
                        # dir: '%kernel.project_dir%/../../../tests/TestApplication/config/doctrine'  # for XML
                        prefix: Tests\YourPlugin  # for attributes
                        # prefix: Tests\YourPlugin\Entity  # for XML mapping

Keep this file minimal. Do not duplicate Sylius core configuration like framework, sylius_shop, or sylius_api unless you explicitly override them.

Last updated

Was this helpful?