Ejemplo n.º 1
0
 /**
  * Listens to "outline.after" event.
  *
  * @param   Behat\Behat\Event\ScenarioEvent     $event
  */
 public function afterOutline(OutlineEvent $event)
 {
     if (StepEvent::FAILED === $event->getResult()) {
         $outline = $event->getOutline();
         $this->writeln($outline->getFile() . ':' . $outline->getLine());
     }
 }
Ejemplo n.º 2
0
 /**
  * Initializes outline example event.
  *
  * @param   Behat\Gherkin\Node\OutlineNode                  $outline
  * @param   integer                                         $iteration  number of iteration
  * @param   Behat\Behat\Environment\EnvironmentInterface    $environment
  * @param   integer                                         $result
  * @param   Boolean                                         $skipped
  */
 public function __construct(OutlineNode $outline, $iteration, EnvironmentInterface $environment, $result = null, $skipped = false)
 {
     parent::__construct($outline, $result);
     $this->iteration = $iteration;
     $this->environment = $environment;
     $this->skipped = $skipped;
 }
Ejemplo n.º 3
0
 /**
  * Initializes outline example event.
  *
  * @param   Behat\Gherkin\Node\OutlineNode          $outline
  * @param   integer                                 $iteration  number of iteration
  * @param   Behat\Behat\Context\ContextInterface    $context
  * @param   integer                                 $result
  * @param   Boolean                                 $skipped
  */
 public function __construct(OutlineNode $outline, $iteration, ContextInterface $context, $result = null, $skipped = false)
 {
     parent::__construct($outline, $result);
     $this->iteration = $iteration;
     $this->context = $context;
     $this->skipped = $skipped;
 }
Ejemplo n.º 4
0
 /**
  * Listens to "outline.after" event.
  *
  * @param OutlineEvent $event
  *
  * @uses printOutlineFooter()
  */
 public function afterOutline(OutlineEvent $event)
 {
     $this->printOutlineFooter($event->getOutline());
 }
 /**
  * Listens to "outline.example.before" event. Starts the scenario on the server.
  *
  * @param $event OutlineEvent Event that contains the scenarioOutline.
  */
 public function beforeOutline(OutlineEvent $event)
 {
     $this->_client->startScenario($event->getOutline()->getTitle());
 }
 /**
  * Configures default Mink session before each scenario.
  * Configuration is based on provided scenario tags:
  *
  * `@javascript` tagged scenarios will get `javascript_session` as default session
  * `@mink:CUSTOM_NAME tagged scenarios will get `CUSTOM_NAME` as default session
  * Other scenarios get `default_session` as default session
  *
  * `@insulated` tag will cause Mink to stop current sessions before scenario
  * instead of just soft-resetting them
  *
  * @param ScenarioEvent|OutlineEvent $event
  */
 public function prepareDefaultMinkSession($event)
 {
     $scenario = $event instanceof ScenarioEvent ? $event->getScenario() : $event->getOutline();
     $session = $this->parameters['default_session'];
     foreach ($scenario->getTags() as $tag) {
         if ('javascript' === $tag) {
             $session = $this->parameters['javascript_session'];
         } elseif (preg_match('/^mink\\:(.+)/', $tag, $matches)) {
             $session = $matches[1];
         }
     }
     if ($scenario->hasTag('insulated')) {
         $this->mink->stopSessions();
     } else {
         $this->mink->resetSessions();
     }
     $this->mink->setDefaultSessionName($session);
 }
Ejemplo n.º 7
0
 /**
  * Configures default Drupal driver to use before each scenario or outline.
  *
  * `@api` tagged scenarios will get the `api_driver` as the default driver.
  *
  * Other scenarios get the `default_driver` as the default driver.
  *
  * @param ScenarioEvent|OutlineEvent $event
  */
 public function prepareDefaultDrupalDriver($event)
 {
     $scenario = $event instanceof ScenarioEvent ? $event->getScenario() : $event->getOutline();
     // Set the default driver.
     $driver = $this->parameters['default_driver'];
     foreach ($scenario->getTags() as $tag) {
         if (isset($this->parameters[$tag . '_driver'])) {
             $driver = $this->parameters[$tag . '_driver'];
         }
     }
     $this->drupal->setDefaultDriverName($driver);
 }
 /**
  * Listens to "outline.before" event.
  *
  * @param OutlineEvent $event
  *
  * @uses printOutlineHeader()
  */
 public function beforeOutline(OutlineEvent $event)
 {
     $outline = $event->getOutline();
     $this->currentScenario = $this->createScenario($outline, 'outline');
 }