/** * @param \Behat\Behat\Context\BehatContext $parent */ public static function loadContexts($parent) { $workingDir = dirname(__DIR__) . '/Context/'; $contexts = scandir($workingDir); foreach ($contexts as $context) { if (is_file($workingDir . '/' . $context . '/FeatureContext.php')) { $className = '\\KayStrobach\\BehatExtension\\Context\\' . $context . '\\FeatureContext'; $parent->useContext($context, new $className()); } } }
/** * @return \Behat\Mink\Behat\Context\MinkContext */ public function getMainContext() { return parent::getMainContext(); }
/** * Get main context or throw exception if not set * * @throws \RuntimeException * * @return BaseFeatureContext */ public function getMainContext() { if (parent::getMainContext() instanceof $this) { throw new \RuntimeException("Sub context has no parent"); } return parent::getMainContext(); }