예제 #1
0
 function load($feature_file)
 {
     App::import('Vendor', 'gherkin');
     $keywords = new Behat\Gherkin\Keywords\CachedArrayKeywords(ROOT . DS . APP_DIR . DS . 'vendors/gherkin/i18n.php');
     $lexer = new Behat\Gherkin\Lexer($keywords);
     $parser = new Behat\Gherkin\Parser($lexer);
     $feature = $parser->parse(file_get_contents($feature_file));
     $case = new FeatureTestCase($feature->getTitle());
     $case->setBackground($feature->getBackground());
     $case->setScenarios($feature->getScenarios());
     return $case;
 }
예제 #2
0
파일: bootstrap.php 프로젝트: habari/tests
 public static function run_all()
 {
     global $options;
     if (isset($options['u'])) {
         $options['u'] = explode(',', $options['u']);
         if (count($options['u']) == 0) {
             unset($options['u']);
         }
     }
     $pass_count = 0;
     $fail_count = 0;
     $exception_count = 0;
     $case_count = 0;
     self::$run_all = true;
     $classes = get_declared_classes();
     $classes = array_unique($classes);
     sort($classes);
     $results = new TestResults();
     foreach ($classes as $class) {
         if ($class == 'Habari\\FeatureTestCase' || isset($options['u']) && !in_array($class, $options['u'])) {
             continue;
         }
         $parents = class_parents($class, false);
         if (in_array('Habari\\UnitTestCase', $parents)) {
             $obj = new $class();
             $results[$class] = $obj->run();
         }
     }
     self::load_steps();
     foreach (self::$features as $feature_file) {
         if (isset($options['u']) && !in_array(basename($feature_file), $options['u'])) {
             continue;
         }
         $obj = new FeatureTestCase($feature_file);
         $obj->assign_step_map(self::$steps, self::$classes);
         $results[$feature_file] = $obj->run();
     }
     while (ob_get_level()) {
         ob_end_clean();
     }
     echo $results;
 }