/** * 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)); }); }
/** * {@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); }
/** * {@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; }
/** * {@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; }
/** * 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; }