public function execute(InputInterface $input, OutputInterface $output)
 {
     $suite = $input->getArgument('suite');
     $step = $input->getArgument('step');
     $config = $this->getSuiteConfig($suite, $input->getOption('config'));
     $class = $this->getClassName($step);
     $path = $this->buildPath(Configuration::supportDir() . 'Step' . DIRECTORY_SEPARATOR . ucfirst($suite), $step);
     $dialog = $this->getHelperSet()->get('question');
     $filename = $path . $class . '.php';
     $helper = $this->getHelper('question');
     $question = new Question("Add action to StepObject class (ENTER to exit): ");
     $gen = new StepObjectGenerator($config, ucfirst($suite) . '\\' . $step);
     if (!$input->getOption('silent')) {
         do {
             $question = new Question('Add action to StepObject class (ENTER to exit): ', null);
             $action = $dialog->ask($input, $output, $question);
             if ($action) {
                 $gen->createAction($action);
             }
         } while ($action);
     }
     $res = $this->save($filename, $gen->produce());
     if (!$res) {
         $output->writeln("<error>StepObject {$filename} already exists</error>");
         exit;
     }
     $output->writeln("<info>StepObject was created in {$filename}</info>");
 }
示例#2
0
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $suite = $input->getArgument('suite');
     $step = $input->getArgument('step');
     $conf = $this->getSuiteConfig($suite, $input->getOption('config'));
     $class = $this->getClassName($step);
     $class = $this->removeSuffix($class, 'Steps');
     $path = $this->buildPath($conf['path'] . '/_steps/', $class);
     $filename = $this->completeSuffix($class, 'Steps');
     $filename = $path . $filename;
     $dialog = $this->getHelperSet()->get('question');
     $gen = new StepObjectGenerator($conf, $class);
     if (!$input->getOption('silent')) {
         do {
             $question = new Question('Add action to StepObject class (ENTER to exit): ', null);
             $action = $dialog->ask($input, $output, $question);
             if ($action) {
                 $gen->createAction($action);
             }
         } while ($action);
     }
     $res = $this->save($filename, $gen->produce());
     $this->introduceAutoloader($conf['path'] . '/' . $conf['bootstrap'], 'Steps', '_steps');
     if (!$res) {
         $output->writeln("<error>StepObject {$filename} already exists</error>");
         exit;
     }
     $output->writeln("<info>StepObject was created in {$filename}</info>");
 }