gorghoa / ScenarioStateBehatExtension

Provide a way to share scenario state through steps
MIT License
33 stars 7 forks source link

Provide a way to map store key and step method injected argument #7

Closed gorghoa closed 8 years ago

gorghoa commented 8 years ago

As in v1.0, to inject a state fragment key to a step method, the methods argument must match the wanted state fragment’s key.

v1.0 Example (granted that scenarioBonobo state fragment has been provided before):

/**
 * @When bonobo gives this banana to :monkey
 */
public function giveBananaToGorilla($monkey, Bonobo $scenarioBonobo)
{
…
}

It would be nice to declare a more flexible mapping through annotations.

Proposal:

/**
 * @When bonobo gives this banana to :monkey
 * @ScenarioStateInject scenarioBonobo to $bonobo
 */
public function giveBananaToGorilla($monkey, Bonobo $bonobo)
{
…
}