示例#1
0
 /**
  * Returns hooks for a specific event.
  *
  * @param HookScope $scope
  *
  * @return Hook[]
  */
 public function getScopeHooks(HookScope $scope)
 {
     return array_filter($this->getEnvironmentHooks($scope->getEnvironment()), function (Hook $hook) use($scope) {
         if ($scope->getName() !== $hook->getScopeName()) {
             return false;
         }
         return !($hook instanceof FilterableHook && !$hook->filterMatches($scope));
     });
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function filterMatches(HookScope $scope)
 {
     if (!$scope instanceof ScenarioScope) {
         return false;
     }
     if (null === ($filterString = $this->getFilterString())) {
         return true;
     }
     return $this->isMatch($scope->getFeature(), $scope->getScenario(), $filterString);
 }
示例#3
0
 /**
  * {@inheritdoc}
  */
 public function filterMatches(HookScope $scope)
 {
     if (!$scope instanceof SuiteScope) {
         return false;
     }
     if (null === ($filterString = $this->getFilterString())) {
         return true;
     }
     if (!empty($filterString)) {
         return $this->isSuiteMatch($scope->getSuite(), $filterString);
     }
     return false;
 }
示例#4
0
 /**
  * {@inheritdoc}
  */
 public function filterMatches(HookScope $scope)
 {
     if (!$scope instanceof StepScope) {
         return false;
     }
     if (null === ($filterString = $this->getFilterString())) {
         return true;
     }
     if (!empty($filterString)) {
         $filter = new NameFilter($filterString);
         if ($filter->isFeatureMatch($scope->getFeature())) {
             return true;
         }
         return $this->isStepMatch($scope->getStep(), $filterString);
     }
     return false;
 }
示例#5
0
 /**
  * Initializes hook call.
  *
  * @param HookScope    $scope
  * @param Hook         $hook
  * @param null|integer $errorReportingLevel
  */
 public function __construct(HookScope $scope, Hook $hook, $errorReportingLevel = null)
 {
     parent::__construct($scope->getEnvironment(), $hook, array($scope), $errorReportingLevel);
     $this->scope = $scope;
 }