Skip to content

MQE-917: Eliminate usage of XSD relative paths #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 17, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;
use Magento\FunctionalTestingFramework\Util\Logger\LoggingUtil;

class GenerateDevUrnCommand extends Command
{
Expand All @@ -25,7 +27,13 @@ protected function configure()
{
$this->setName('generate:urn-catalog')
->setDescription('This command generates an URN catalog to enable PHPStorm to recognize and highlight URNs.')
->addArgument('path', InputArgument::REQUIRED, 'path to PHPStorm misc.xml file (typically located in [ProjectRoot]/.idea/misc.xml)');
->addArgument('path', InputArgument::REQUIRED, 'path to PHPStorm misc.xml file (typically located in [ProjectRoot]/.idea/misc.xml)')
->addOption(
"force",
'f',
InputOption::VALUE_NONE,
'forces creation of misc.xml file if not found in the path given.'
);
}

/**
Expand All @@ -40,12 +48,20 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$miscXmlFilePath = $input->getArgument('path') . DIRECTORY_SEPARATOR . "misc.xml";
$miscXmlFile = realpath($miscXmlFilePath);
$force = $input->getOption('force');

if ($miscXmlFile === false) {
$exceptionMessage = "misc.xml not found in given path '{$miscXmlFilePath}'";
LoggingUtil::getInstance()->getLogger(GenerateDevUrnCommand::class)
->error($exceptionMessage);
throw new TestFrameworkException($exceptionMessage);
if ($force == true) {
// create file and refresh realpath
$xml = "<project version=\"4\"/>";
file_put_contents($miscXmlFilePath, $xml);
$miscXmlFile = realpath($miscXmlFilePath);
} else {
$exceptionMessage = "misc.xml not found in given path '{$miscXmlFilePath}'";
LoggingUtil::getInstance()->getLogger(GenerateDevUrnCommand::class)
->error($exceptionMessage);
throw new TestFrameworkException($exceptionMessage);
}
}
$dom = new \DOMDocument('1.0');
$dom->preserveWhiteSpace = false;
Expand Down