/** * Initializes context. * Every scenario gets it's own context object. */ public function __construct() { if (!self::$suite->hasSetting('template')) { throw new \RuntimeException("Template not set. Please start testsuite using the --profile argument."); } $this->registerErrorHandler(); $this->dirtyConfigElements = array(); }
/** * {@inheritdoc} */ public function locateSpecifications(Suite $suite, $locator) { if (!$suite->hasSetting('paths')) { return new NoSpecificationsIterator($suite); } $suiteLocators = $this->getSuitePaths($suite); if ($locator) { $filters = array(new PathsFilter($suiteLocators)); return new LazyFeatureIterator($suite, $this->gherkin, $this->findFeatureFiles($locator), $filters); } $featurePaths = array(); foreach ($suiteLocators as $suiteLocator) { $featurePaths = array_merge($featurePaths, $this->findFeatureFiles($suiteLocator)); } return new LazyFeatureIterator($suite, $this->gherkin, $featurePaths); }
private function getJavascriptSession(Suite $suite) { if (!$suite->hasSetting('mink_javascript_session')) { if (null === $this->javascriptSession) { throw new ProcessingException('The @javascript tag cannot be used without enabling a javascript session'); } return $this->javascriptSession; } $session = $suite->getSetting('mink_javascript_session'); if (!is_string($session)) { throw new SuiteConfigurationException(sprintf('`mink_javascript_session` setting of the "%s" suite is expected to be a string, %s given.', $suite->getName(), gettype($session)), $suite->getName()); } if (!in_array($session, $this->availableJavascriptSessions)) { throw new SuiteConfigurationException(sprintf('`mink_javascript_session` setting of the "%s" suite is not a javascript session. %s given but expected one of %s.', $suite->getName(), $session, implode(', ', $this->availableJavascriptSessions)), $suite->getName()); } return $session; }
/** * {@inheritdoc} */ public function supportsSuite(Suite $suite) { return $suite->hasSetting('contexts_as_services'); }
/** * Returns list of filters from suite settings. * * @param Suite $suite * * @return FilterInterface[] */ private function getSuiteFilters(Suite $suite) { if (!$suite->hasSetting('filters') || !is_array($suite->getSetting('filters'))) { return array(); } $filters = array(); foreach ($suite->getSetting('filters') as $type => $filterString) { $filters[] = $this->createFilter($type, $filterString, $suite); } return $filters; }
/** * {@inheritdoc} */ public function supportsSuite(Suite $suite) { return $suite->hasSetting('paths') && is_array($suite->getSetting('paths')); }