magento/magento2-functional-testing-framework

Cannot generate URN if misc.xml doesn't exist

lazyguru opened this issue · 2 comments

If the .idea/misc.xml file doesn't already exist, the generate:urn-catalog command fails with:

PHP Notice:  file_get_contents(): read of 8192 bytes failed with errno=21 Is a directory in vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Console/GenerateDev
UrnCommand.php on line 82

Notice: file_get_contents(): read of 8192 bytes failed with errno=21 Is a directory in vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Console/GenerateDevUrnCo
mmand.php on line 82
PHP Warning:  DOMDocument::loadXML(): Empty string supplied as input in vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Console/GenerateDevUrnCommand.php on li
ne 82

Warning: DOMDocument::loadXML(): Empty string supplied as input in vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Console/GenerateDevUrnCommand.php on line 82
PHP Fatal error:  Uncaught Error: Call to a member function appendChild() on null in vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Console/GenerateDevUrnComm
and.php:95
Stack trace:
#0 vendor/symfony/console/Command/Command.php(255): Magento\FunctionalTestingFramework\Console\GenerateDevUrnCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\C
onsole\Output\ConsoleOutput))
#1 vendor/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Magento\FunctionalTestingFramework\Console\GenerateDevUrnCommand), Object(Symfony\Component\Cons
ole\Input\ArgvInput), Object(Symfony in vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Console/GenerateDevUrnCommand.php on line 95

Fatal error: Uncaught Error: Call to a member function appendChild() on null in vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Console/GenerateDevUrnCommand.p
hp:95
Stack trace:
#0 vendor/symfony/console/Command/Command.php(255): Magento\FunctionalTestingFramework\Console\GenerateDevUrnCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\C
onsole\Output\ConsoleOutput))
#1 vendor/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Magento\FunctionalTestingFramework\Console\GenerateDevUrnCommand), Object(Symfony\Component\Cons
ole\Input\ArgvInput), Object(Symfony in vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Console/GenerateDevUrnCommand.php on line 95

Preconditions

  1. Magento 2.4.1 installed via composer
  2. I'm using PHP 7.4, though I don't think that actually matters here
  3. No .idea/misc.xml file exists

Steps to reproduce

  1. Execute vendor/bin/mftf generate:urn-catalog .idea/misc.xml

Expected result

  1. .idea/misc.xml is updated with URN for MFTF

Actual result

  1. See error from description

Additional info

If you run bin/magento dev:urn-catalog:generate .idea/misc.xml it properly handles for the file not existing and creates it. You can then update it with MFTF info afterwards using vendor/bin/mftf generate:urn-catalog .idea/misc.xml

Hi @lazyguru. Thank you for your report.
To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


jilu1 commented

@lazyguru
I cannot reproduce this issue in MFTF 3.2.0 + Magento 2.4.1.

$ vendor/bin/mftf generate:urn-catalog .idea/misc.xml

In GenerateDevUrnCommand.php line 76:
                                                     
  misc.xml not found in given path '.idea/misc.xml'  
                                                     
generate:urn-catalog [-f|--force] [--] <path>

Could you update mftf and try it again?