setDefinition([ new InputArgument('suite', InputArgument::REQUIRED, 'Suite for StepObject'), new InputArgument('step', InputArgument::REQUIRED, 'StepObject name'), new InputOption('silent', '', InputOption::VALUE_NONE, 'skip verification question'), ]); } public function getDescription() { return 'Generates empty StepObject class'; } public function execute(InputInterface $input, OutputInterface $output) { $suite = $input->getArgument('suite'); $step = $input->getArgument('step'); $config = $this->getSuiteConfig($suite); $class = $this->getShortClassName($step); $path = $this->createDirectoryFor(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->createFile($filename, $gen->produce()); if (!$res) { $output->writeln("StepObject $filename already exists"); exit; } $output->writeln("StepObject was created in $filename"); } }