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-10-28 01:43:09 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