Exemplo n.º 1
0
 public function __construct(EventInterface $event)
 {
     $tags = array();
     if ($event instanceof ScenarioEvent) {
         $tags = $event->getScenario()->getOwnTags();
     } else {
         if ($event instanceof FeatureEvent) {
             $tags = $event->getFeature()->getTags();
         } else {
             if ($event instanceof OutlineExampleEvent) {
                 $tags = $event->getOutline()->getOwnTags();
             } else {
                 throw new \InvalidArgumentException(get_class($event) . ' is unsupported event type.');
             }
         }
     }
     parent::__construct($tags);
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function filterMatches(EventInterface $event)
 {
     if (null === ($filterString = $this->getFilter())) {
         return true;
     }
     $feature = $event->getFeature();
     if (false !== strpos($filterString, '@')) {
         $filter = new TagFilter($filterString);
         if ($filter->isFeatureMatch($feature)) {
             return true;
         }
     } elseif (!empty($filterString)) {
         $filter = new NameFilter($filterString);
         if ($filter->isFeatureMatch($feature)) {
             return true;
         }
     }
     return false;
 }