Behat/Behat — Issue #67: Impossible to modify scenarios in beforeFeature event
Author: marmotz
Created: 2011-11-07 17:02:21+00:00
State: open

In a FeatureContext, if I create a "@beforeFeature" static method, i can't modify scenarios (add tag(s), by example) because in behat/src/Behat/Behat/Tester/FeatureTester.php file, scenarios was already get in a variable (line 75) and use later (line 80).

I think, you should do something like that:

if (count($feature->getScenarios())) {
$this->dispatcher->dispatch(
'beforeFeature', new FeatureEvent($feature, $this->parameters)
);

foreach ($feature->getScenarios() as $scenario) {
...
}
}