4 * This file is part of the Gherkin.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 namespace Behat\Gherkin\Filter;
13 use Behat\Gherkin\Node\ScenarioInterface;
14 use Behat\Gherkin\Node\FeatureNode;
17 * Filters features by their narrative using regular expression.
19 * @author Konstantin Kudryashov <ever.zet@gmail.com>
21 class NarrativeFilter extends SimpleFilter
31 * @param string $regex
33 public function __construct($regex)
35 $this->regex = $regex;
39 * Checks if Feature matches specified filter.
41 * @param FeatureNode $feature Feature instance
45 public function isFeatureMatch(FeatureNode $feature)
47 return 1 === preg_match($this->regex, $feature->getDescription());
51 * Checks if scenario or outline matches specified filter.
53 * @param ScenarioInterface $scenario Scenario or Outline node instance
57 public function isScenarioMatch(ScenarioInterface $scenario)