yavin/behat-context-injection-extension

ability to inject other contexts to steps methods

v1.0.0 2016-04-24 10:55 UTC

This package is auto-updated.

Last update: 2024-04-28 00:37:45 UTC


README

Build Status

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

  1. With composer.json

    composer require yavin/behat-context-injection-extension:~1.0
    
  2. 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