public function execute(InputInterface $input, OutputInterface $output) { $suite = $input->getArgument('suite'); $class = $input->getArgument('page'); if (!$class) { $class = $suite; $suite = null; } $conf = $suite ? $this->getSuiteConfig($suite, $input->getOption('config')) : $this->getGlobalConfig($input->getOption('config')); $className = $this->getClassName($class); $filename = $suite ? $this->pathToSuitePageObject($conf, $className) : $this->pathToGlobalPageObject($conf, $className); $gen = new PageObjectGenerator($conf, $class); $res = $this->save($filename, $gen->produce()); if (!$res) { $output->writeln("<error>PageObject {$filename} already exists</error>"); exit; } $output->writeln("<info>PageObject was created in {$filename}</info>"); }
public function execute(InputInterface $input, OutputInterface $output) { $suite = $input->getArgument('suite'); $class = $input->getArgument('page'); if (!$class) { $class = $suite; $suite = null; } $conf = $suite ? $this->getSuiteConfig($suite, $input->getOption('config')) : $this->getGlobalConfig($input->getOption('config')); if ($suite) { $suite = DIRECTORY_SEPARATOR . ucfirst($suite); } $path = $this->buildPath(Configuration::supportDir() . 'Page' . $suite, $class); $filename = $path . $this->getClassName($class) . '.php'; $output->writeln($filename); $gen = new PageObjectGenerator($conf, ucfirst($suite) . '\\' . $class); $res = $this->save($filename, $gen->produce()); if (!$res) { $output->writeln("<error>PageObject {$filename} already exists</error>"); exit; } $output->writeln("<info>PageObject was created in {$filename}</info>"); }