gorghoa / ScenarioStateBehatExtension

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

Add @ScenarioStateArgument() annotation on step argument transformations #25

Closed raoulclais closed 7 years ago

raoulclais commented 7 years ago

If I want to get a fragment inside a step argument transformation I need to do this :

/**
 * @Transform :banana
 */
public function smashBanana(string $banana): SmashedBanana
{
    $numberOfPieces = $this->scenarioState->getStateFragment('numberOfPieces');

    return new SmashedBanana($banana, $numberOfPieces);
}

Would it be possible to do this also ?

/**
 * @Transform :banana
 *
 * @ScenarioStateArgument("numberOfPieces")
 */
public function smashBanana(string $banana, int $numberOfPieces): SmashedBanana
{
    return new SmashedBanana($banana, $numberOfPieces);
}