solutiondrive / behat-symfony-dependency-injection-container-extension
Allows to load additional dependency injection config files for behat
Installs: 483
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 6
Forks: 0
Open Issues: 0
Language:Gherkin
This package is auto-updated.
Last update: 2024-10-19 20:01:06 UTC
README
Extension to load additional dependency injection config files for behat
Inspired by FriendsOfBehat/ServiceContainerExtension
Usage
-
Install it:
$ composer require solutiondrive/behat-symfony-dependency-injection-container-extension --dev
-
Enable this extension and configure Behat to use it:
# behat.yml default: # ... extensions: solutionDrive\BehatSymfonyDependencyInjectionContainerExtension: identifiers: solutionDrive: imports: - "config/solutionDrive/services.xml" - "config/solutionDrive/services.yml" - "config/solutionDrive/services.php"
-
Write services file definitions:
<!-- config/solutionDrive/services.xml --> <?xml version="1.0" encoding="UTF-8" ?> <container xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://symfony.com/schema/dic/services"> <services> <service id="acme.my_service" class="Acme\MyService" /> </services> </container>
# config/solutionDrive/services.yml services: acme.my_service: class: Acme\MyService
// config/solutionDrive/services.php use Symfony\Component\DependencyInjection\Definition; $container->setDefinition('acme.my_service', new Definition(\Acme\MyService::class));