X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fbehat%2Fgherkin%2Fsrc%2FBehat%2FGherkin%2FFilter%2FTagFilter.php;fp=vendor%2Fbehat%2Fgherkin%2Fsrc%2FBehat%2FGherkin%2FFilter%2FTagFilter.php;h=0000000000000000000000000000000000000000;hp=fed6c1afd34f8a529e1c255be570e3364a9863b7;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/vendor/behat/gherkin/src/Behat/Gherkin/Filter/TagFilter.php b/vendor/behat/gherkin/src/Behat/Gherkin/Filter/TagFilter.php deleted file mode 100644 index fed6c1afd..000000000 --- a/vendor/behat/gherkin/src/Behat/Gherkin/Filter/TagFilter.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Filter; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioInterface; - -/** - * Filters scenarios by feature/scenario tag. - * - * @author Konstantin Kudryashov - */ -class TagFilter extends ComplexFilter -{ - protected $filterString; - - /** - * Initializes filter. - * - * @param string $filterString Name filter string - */ - public function __construct($filterString) - { - $this->filterString = trim($filterString); - } - - /** - * Checks if Feature matches specified filter. - * - * @param FeatureNode $feature Feature instance - * - * @return Boolean - */ - public function isFeatureMatch(FeatureNode $feature) - { - return $this->isTagsMatchCondition($feature->getTags()); - } - - /** - * Checks if scenario or outline matches specified filter. - * - * @param FeatureNode $feature Feature node instance - * @param ScenarioInterface $scenario Scenario or Outline node instance - * - * @return Boolean - */ - public function isScenarioMatch(FeatureNode $feature, ScenarioInterface $scenario) - { - return $this->isTagsMatchCondition(array_merge($feature->getTags(), $scenario->getTags())); - } - - /** - * Checks that node matches condition. - * - * @param string[] $tags - * - * @return Boolean - */ - protected function isTagsMatchCondition($tags) - { - $satisfies = true; - - foreach (explode('&&', $this->filterString) as $andTags) { - $satisfiesComma = false; - - foreach (explode(',', $andTags) as $tag) { - $tag = str_replace('@', '', trim($tag)); - - if ('~' === $tag[0]) { - $tag = mb_substr($tag, 1, mb_strlen($tag, 'utf8') - 1, 'utf8'); - $satisfiesComma = !in_array($tag, $tags) || $satisfiesComma; - } else { - $satisfiesComma = in_array($tag, $tags) || $satisfiesComma; - } - } - - $satisfies = (false !== $satisfiesComma && $satisfies && $satisfiesComma) || false; - } - - return $satisfies; - } -}