/**
  * Listens to "feature.after" event
  *
  * @param FeatureEvent $event
  */
 public function afterFeature(FeatureEvent $event)
 {
     $fileName = $event->getFeature()->getFile();
     $relativeName = substr($fileName, strpos($fileName, 'features'));
     $this->writeLn();
     $this->write(sprintf('Executed feature %s', $relativeName));
 }
 /**
  * @BeforeFeature
  */
 public static function beforeFeature(FeatureEvent $event)
 {
     $parameters = $event->getContextParameters();
     $conn = DriverManager::getConnection($parameters['db']);
     $tables = array('repository', 'commit_audit', 'commit', 'author_audit', 'author', 'project', 'revisions');
     $conn->exec('SET foreign_key_checks = 0;');
     foreach ($tables as $table) {
         $conn->exec('TRUNCATE ' . $table);
     }
     $conn->exec('SET foreign_key_checks = 1;');
 }
Exemple #3
0
 /**
  * Runs feature hooks with specified name.
  *
  * @param   string                          $name   hooks name
  * @param   Behat\Behat\Event\FeatureEvent  $event  event to which hooks glued
  */
 protected function fireFeatureHooks($name, FeatureEvent $event)
 {
     if (!count($this->hooks)) {
         $this->loadHooks();
     }
     $feature = $event->getFeature();
     $hooks = isset($this->hooks[$name]) ? $this->hooks[$name] : array();
     foreach ($hooks as $hook) {
         if (is_callable($hook)) {
             call_user_func($hook, $event);
         } elseif (!empty($hook[0]) && false !== strpos($hook[0], '@')) {
             $filter = new TagFilter($hook[0]);
             if ($filter->isFeatureMatch($feature)) {
                 call_user_func($hook[1], $event);
             }
         } elseif (!empty($hook[0])) {
             $filter = new NameFilter($hook[0]);
             if ($filter->isFeatureMatch($feature)) {
                 call_user_func($hook[1], $event);
             }
         } else {
             call_user_func($hook[1], $event);
         }
     }
 }
 /**
  * Listens to "feature.after" event.
  *
  * @param FeatureEvent $event
  *
  * @uses printTestSuiteFooter()
  * @uses flushOutputConsole()
  */
 public function afterFeature(FeatureEvent $event)
 {
     $this->printTestSuiteFooter($event->getFeature(), microtime(true) - $this->featureStartTime);
     $this->flushOutputConsole();
 }
Exemple #5
0
 /**
  * Listens to "feature.after" event.
  *
  * @param FeatureEvent $event
  *
  * @uses printFeatureFooter()
  */
 public function afterFeature(FeatureEvent $event)
 {
     $this->printFeatureFooter($event->getFeature());
 }
 /**
  * Listens to "feature.after" event.
  *
  * @param FeatureEvent $event
  */
 public function afterFeature(FeatureEvent $event)
 {
     $this->writeln($event->getFeature()->getFile() . '::' . self::$stepcount);
 }
Exemple #7
0
 /**
  * Gives access to moodle codebase, to keep track of feature end time.
  *
  * @param FeatureEvent $event event fired after feature.
  * @AfterFeature
  */
 public static function after_feature(FeatureEvent $event)
 {
     if (!defined('BEHAT_FEATURE_TIMING_FILE')) {
         return;
     }
     $file = $event->getFeature()->getFile();
     self::$timings[$file] = microtime(true) - self::$timings[$file];
     // Probably didn't actually run this, don't output it.
     if (self::$timings[$file] < 1) {
         unset(self::$timings[$file]);
     }
 }
 private function buildFeatureEvent(FeatureEvent $event)
 {
     $node = $event->getFeature();
     $message = 'Feature: ' . $node->getTitle() . ' line: ' . $node->getLine();
     $this->file = $node->getFile();
     $this->line = $node->getLine();
     $this->text = $node->getTitle();
     $this->node = $node;
     return $message;
 }
Exemple #9
0
 /**
  * Listens to "feature.after" event.
  *
  * @param   Behat\Behat\Event\FeatureEvent  $event
  *
  * @uses    collectFeatureResult()
  */
 public function afterFeature(FeatureEvent $event)
 {
     $this->collectFeatureResult($event->getResult());
 }
 public function beforeFeature(FeatureEvent $event)
 {
     $this->_client->setFeatureText($event->getFeature()->getTitle());
 }
Exemple #11
0
 /** @AfterFeature */
 public static function featureTearDown(FeatureEvent $event)
 {
     $fixtureContext = new PHPUnitFixtureContext($event->getParameters());
     $fixtureContext->tearDownDBTester('ushahidi/Base');
 }
 /**
  * Sets featurefile name, which is used by test plan generator.
  *
  * @param FeatureEvent $event event fired before feature.
  * @throws coding_exception If here we are not using the test database it should be because of a coding error
  * @BeforeFeature
  */
 public static function before_feature(FeatureEvent $event)
 {
     self::$featurefile = $event->getFeature()->getFile();
     preg_match('/^.*\\/(\\w*)\\.feature/i', self::$featurefile, $matches);
     self::$featurefile = $matches[1];
     self::$threadgroupname = $event->getFeature()->getTitle();
 }
 /**
  * Listens to "feature.before" event.
  *
  * @param FeatureEvent $event
  *
  * @uses printFeatureHeader()
  */
 public function beforeFeature(FeatureEvent $event)
 {
     $feature = $event->getFeature();
     $tags = $feature->getOwnTags();
     $this->currentFeature = array('name' => $feature->getTitle(), 'tags' => $tags, 'description' => $feature->getDescription(), 'scenarios' => array(), 'background' => array());
 }