lcobucci/behat-di-builder-extension
最新稳定版本:1.3.0
Composer 安装命令:
composer require lcobucci/behat-di-builder-extension
包简介
A behat extension that allows injecting services from a container created with lcobucci/di-builder in contexts
README 文档
README
Allows injecting services from a container created using lcobucci/di-builder
in a Behat context.
Installation
Package is available on Packagist, you can install it using Composer.
composer require --dev lcobucci/behat-di-builder-extension
Basic usage
You must first enable the extension on your behat configuration file:
default: # ... extensions: Lcobucci\DependencyInjection\Behat\BuilderExtension: ~
Then enable the use of the test container (create by the extension) in the suite configuration:
default: suites: my-suite: services: "@test_container" extensions: Lcobucci\DependencyInjection\Behat\BuilderExtension: ~
And finally inject the services into your contexts
default: suites: my-suite: services: "@test_container" contexts: - My\Lovely\Context: - "@my_service" extensions: Lcobucci\DependencyInjection\Behat\BuilderExtension: ~
Advanced configuration
You can provide the following parameters to the extension to better configure it:
- name: if you already have an extension using
test_container - container_builder: if your application already uses
lcobucci/di-builderand you want to use it (instead of a blank container builder) - packages: so that you can add/override service definitions for testing
Your behat.yml would look like this with those settings:
default: suites: my-suite: services: "@my_container" contexts: - My\Lovely\Context: - "@my_service" extensions: Lcobucci\DependencyInjection\Behat\BuilderExtension: name: "my_container" container_builder: "config/container_builder.php" packages: My\DIBuilder\Package: ~ My\DIBuilder\PackageWithConstructorArguments: - "one" - "two"
统计信息
- 总下载量: 36.21k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-11-27