yavin / behat-context-injection-extension
能够将其他上下文注入到步骤方法中
v1.0.0
2016-04-24 10:55 UTC
Requires
- behat/behat: ^3.1
This package is auto-updated.
Last update: 2024-08-28 01:16:20 UTC
README
使用此扩展,您可以向方法中注入上下文。它应该与 Behat 3.1+ 兼容
class MyContext implements Context { /** * @Then I can inject context as argument */ public function iCanInjectContextAsArgument(MyOtherContextClass $myOtherContext) { $myOtherContext->someMethod(); } //... }
安装
-
使用 composer.json
composer require yavin/behat-context-injection-extension:~1.0
-
将扩展添加到
behat.yml
default: suites: example: paths: [ %paths.base%/my/features/path ] contexts: - My\Context\Namespace\MyContext - My\Context\Namespace\MyOtherContextClass extensions: Yavin\Behat\Extension\ContextInjection\ContextInjectionExtension: ~
在 /tests
目录中的示例实现