コード例 #1
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     passthru('clear');
     $this->line('');
     $this->comment("Running acceptance tests... \n\n");
     $input = array();
     $input[] = '';
     $options = array('format', 'no-snippets', 'tags', 'out', 'profile', 'name');
     foreach ($options as $option) {
         if ($format = $this->input->getOption($option)) {
             $input[] = "--{$option}=" . $format;
         }
     }
     $switches = array('stop-on-failure', 'strict');
     foreach ($switches as $switch) {
         if ($this->input->getOption($switch)) {
             $input[] = '--' . $switch;
         }
     }
     $profile = $this->option('profile');
     if (!empty($profile)) {
         $profile_config = $this->loadConfig($profile);
     } else {
         $profile_config = $this->loadConfig('default');
     }
     $input[] = $profile_config['paths']['features'] . '/' . $this->input->getArgument('feature');
     // Running with output color
     $app = new \Behat\Behat\Console\BehatApplication('DEV');
     $app->run(new \Symfony\Component\Console\Input\ArgvInput($input));
 }
コード例 #2
0
ファイル: StoryShell.php プロジェクト: nojimage/Bdd
 public function main()
 {
     $this->_initDb();
     $args = $_SERVER['argv'];
     do {
         array_shift($args);
     } while ($args[0] != 'Bdd.story');
     // Internal encoding to utf8
     mb_internal_encoding('utf8');
     $app = new Behat\Behat\Console\BehatApplication(BEHAT_VERSION);
     $command_option = false;
     foreach ($args as $option) {
         $option = str_replace("-", "", $option);
         if ($app->getDefinition()->hasOption($option) || $app->getDefinition()->hasShortcut($option)) {
             $command_option = true;
             break;
         }
     }
     // Load default config
     if (!in_array('--config', $args) && !in_array('-c', $args) && !$command_option) {
         array_push($args, '--config', APP . DS . 'Config' . DS . 'behat.yml');
     }
     $input = new Symfony\Component\Console\Input\ArgvInput($args);
     $app->run($input);
 }
コード例 #3
0
ファイル: behat.php プロジェクト: lloiacono/MageBehat
 public function run()
 {
     require_once BP . '/lib/autoload.php';
     $this->_validate();
     $this->_init();
     try {
         foreach (Mage::getConfig()->loadModules()->getNode('modules')->children() as $moduleName => $module) {
             $featureDir = Mage::getConfig()->getModuleDir('', $moduleName) . DS . 'Test' . DS . 'features';
             $runBehat = false;
             //only run behat once we have found at least one feature file
             if (is_dir($featureDir)) {
                 foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($featureDir)) as $file) {
                     if (pathinfo($file->getFilename(), PATHINFO_EXTENSION) == 'feature') {
                         $runBehat = true;
                         break;
                     }
                 }
             }
             if ($runBehat) {
                 //TODO: work out a way to pass this through the application
                 Mage::register('magebehat/current_module', $moduleName);
                 $app = new Behat\Behat\Console\BehatApplication(BEHAT_VERSION);
                 $input = new StringInput($this->getArgs($moduleName) . $featureDir);
                 $app->setAutoExit(false);
                 $app->run($input);
                 Mage::unregister('magebehat/current_module');
             }
         }
     } catch (Exception $e) {
         Mage::logException($e);
     }
 }
コード例 #4
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     passthru('clear');
     $this->line('');
     $path = "report_test.html";
     if ($this->input->getOption('out')) {
         $path = $this->input->getOption('out');
     }
     $profile = $this->option('profile');
     if (!empty($profile)) {
         $profile_config = $this->loadConfig($profile);
     } else {
         $profile = 'default';
         $profile_config = $this->loadConfig($profile);
     }
     $input[] = realpath($profile_config['paths']['features'] . '/../');
     $input[] = '--format=html';
     $input[] = '--out=' . $path;
     $input[] = '--profile=' . $profile;
     $this->comment("Creating doc...");
     $app = new \Behat\Behat\Console\BehatApplication('DEV');
     $app->run(new \Symfony\Component\Console\Input\ArgvInput($input));
 }
コード例 #5
0
 public function __construct($classNameContext)
 {
     parent::__construct(BEHAT_VERSION);
     $this->_classNameContext = $classNameContext;
 }
コード例 #6
0
ファイル: behat.php プロジェクト: ryanhouston/Behat
#!/usr/bin/env php
<?php 
/*
 * Behat
 *
 * This file is part of the Behat.
 * (c) Konstantin Kudryashov <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
define('BEHAT_PHP_BIN_PATH', '/usr/bin/env php');
define('BEHAT_BIN_PATH', __FILE__);
define('BEHAT_VERSION', 'DEV');
if (is_file(__DIR__ . '/../autoload.php')) {
    require_once __DIR__ . '/../autoload.php';
} elseif (is_file(__DIR__ . '/../autoload.php.dist')) {
    require_once __DIR__ . '/../autoload.php.dist';
} else {
    require_once 'behat/autoload.php.dist';
}
// Internal encoding to utf8
mb_internal_encoding('utf8');
$app = new Behat\Behat\Console\BehatApplication(BEHAT_VERSION);
$app->run();