コード例 #1
0
 /**
  * @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());
         }
     }
 }
コード例 #2
0
 /**
  * @return \Behat\Mink\Behat\Context\MinkContext
  */
 public function getMainContext()
 {
     return parent::getMainContext();
 }
コード例 #3
0
 /**
  * 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();
 }