yavin / behat-context-injection-extension
ability to inject other contexts to steps methods
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/yavin/behat-context-injection-extension
Requires
- behat/behat: ^3.1
This package is auto-updated.
Last update: 2025-09-28 03:36:11 UTC
README
With this extension you can inject contexts into methods. It should work with Behat 3.1+
class MyContext implements Context { /** * @Then I can inject context as argument */ public function iCanInjectContextAsArgument(MyOtherContextClass $myOtherContext) { $myOtherContext->someMethod(); } //... }
Instalation
-
With composer.json
composer require yavin/behat-context-injection-extension:~1.0
-
Add extension to
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: ~
example implementation in /tests
directory