https://github.com/friendsofbehat/servicecontainerextension
:radio: Allows to declare own services inside Behat container without writing an extension.
https://github.com/friendsofbehat/servicecontainerextension
behat behat-extension dependency-injection php
Last synced: 12 months ago
JSON representation
:radio: Allows to declare own services inside Behat container without writing an extension.
- Host: GitHub
- URL: https://github.com/friendsofbehat/servicecontainerextension
- Owner: FriendsOfBehat
- License: mit
- Created: 2016-07-27T21:32:26.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-11-05T21:30:42.000Z (over 5 years ago)
- Last Synced: 2024-04-26T09:22:14.559Z (almost 2 years ago)
- Topics: behat, behat-extension, dependency-injection, php
- Language: Gherkin
- Homepage:
- Size: 51.8 KB
- Stars: 115
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Service Container Extension [](https://packagist.org/packages/friends-of-behat/service-container-extension) [](https://packagist.org/packages/friends-of-behat/service-container-extension) [](http://travis-ci.org/FriendsOfBehat/ServiceContainerExtension) [](https://scrutinizer-ci.com/g/FriendsOfBehat/ServiceContainerExtension/)
Allows to declare own services inside Behat container without writing an extension.
## Usage
1. Install it:
```bash
$ composer require friends-of-behat/service-container-extension --dev
```
2. Enable this extension and configure Behat to use it:
```yaml
# behat.yml
default:
# ...
extensions:
FriendsOfBehat\ServiceContainerExtension:
imports:
- "features/bootstrap/config/services.xml"
- "features/bootstrap/config/services.yml"
- "features/bootstrap/config/services.php"
```
3. Write services files definitions:
```xml
```
```yaml
# features/bootstrap/config/services.yml
services:
acme.my_service:
class: Acme\MyService
```
```php
// features/bootstrap/config/services.php
use Symfony\Component\DependencyInjection\Definition;
$container->setDefinition('acme.my_service', new Definition(\Acme\MyService::class));
```