setDefinition([
new InputArgument('suite', InputArgument::REQUIRED, 'Either suite name or page object name)'),
new InputArgument('page', InputArgument::OPTIONAL, 'Page name of pageobject to represent'),
]);
parent::configure();
}
public function getDescription()
{
return 'Generates empty PageObject class';
}
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)
: $this->getGlobalConfig();
if ($suite) {
$suite = DIRECTORY_SEPARATOR . ucfirst($suite);
}
$path = $this->createDirectoryFor(Configuration::supportDir() . 'Page' . $suite, $class);
$filename = $path . $this->getShortClassName($class) . '.php';
$output->writeln($filename);
$gen = new PageObjectGenerator($conf, ucfirst($suite) . '\\' . $class);
$res = $this->createFile($filename, $gen->produce());
if (!$res) {
$output->writeln("PageObject $filename already exists");
exit;
}
$output->writeln("PageObject was created in $filename");
}
protected function pathToPageObject($class, $suite)
{
}
}