magento2: Integration Test Framework do not work out the box. Not compatible with PhpUnit 9.3.x

Preconditions

  1. Magento 2.4.0

Steps to reproduce

  1. Run Integration Test Framework on a new test or existing Magento 2 test.
  2. cd into the following folder: dev/tests/integration
  3. ../../../vendor/phpunit/phpunit/phpunit --configuration phpunit.xml

Expected Result

  1. Tests run.

Actual Result

PHP Fatal error:  Uncaught Error: Class 'PHPUnit\TextUI\Configuration\Registry' not found in /var/www/dev/tests/integration/testsuite/Magento/IntegrationTest.php:32
Stack trace:
#0 [internal function]: Magento\IntegrationTest::suite('Magento\\Integra...')
#1 /var/www/vendor/phpunit/phpunit/src/Framework/TestSuite.php(476): ReflectionMethod->invoke(NULL, 'Magento\\Integra...')
#2 /var/www/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/TestSuite/TestSuiteMapper.php(65): PHPUnit\Framework\TestSuite->addTestFile('/var/www/dev/te...')
#3 /var/www/vendor/phpunit/phpunit/src/TextUI/Command.php(389): PHPUnit\TextUI\XmlConfiguration\TestSuiteMapper->map(Object(PHPUnit\TextUI\XmlConfiguration\TestSuiteCollection), '')
#4 /var/www/vendor/phpunit/phpunit/src/TextUI/Command.php(116): PHPUnit\TextUI\Command->handleArguments(Array)
#5 /var/www/vendor/phpunit/phpunit/src/TextUI/Command.php(101): PHPUnit\TextUI\Command->run(Array, true)
#6 /var/www/vendor/phpunit/phpunit/phpunit(61): PHPUnit\TextUI\Command::main()
#7 {main}

Next PHPUnit\T in /var/www/vendor/phpunit/phpunit/src/TextUI/Command.php on line 103

Fatal error: Uncaught Error: Class 'PHPUnit\TextUI\Configuration\Registry' not found in /var/www/dev/tests/integration/testsuite/Magento/IntegrationTest.php:32
Stack trace:
#0 [internal function]: Magento\IntegrationTest::suite('Magento\\Integra...')
#1 /var/www/vendor/phpunit/phpunit/src/Framework/TestSuite.php(476): ReflectionMethod->invoke(NULL, 'Magento\\Integra...')
#2 /var/www/vendor/phpunit/phpunit/src/TextUI/XmlConfiguration/TestSuite/TestSuiteMapper.php(65): PHPUnit\Framework\TestSuite->addTestFile('/var/www/dev/te...')
#3 /var/www/vendor/phpunit/phpunit/src/TextUI/Command.php(389): PHPUnit\TextUI\XmlConfiguration\TestSuiteMapper->map(Object(PHPUnit\TextUI\XmlConfiguration\TestSuiteCollection), '')
#4 /var/www/vendor/phpunit/phpunit/src/TextUI/Command.php(116): PHPUnit\TextUI\Command->handleArguments(Array)
#5 /var/www/vendor/phpunit/phpunit/src/TextUI/Command.php(101): PHPUnit\TextUI\Command->run(Array, true)
#6 /var/www/vendor/phpunit/phpunit/phpunit(61): PHPUnit\TextUI\Command::main()
#7 {main}

Next PHPUnit\T in /var/www/vendor/phpunit/phpunit/src/TextUI/Command.php on line 103
PHP Fatal error:  Uncaught Exception: sh: tasklist.exe: not found in /var/www/vendor/magento/framework/Shell.php:63
Stack trace:
#0 /var/www/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php(92): Magento\Framework\Shell->execute('tasklist.exe /f...', Array)
#1 /var/www/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php(58): Magento\TestFramework\Helper\Memory->_getWinProcessMemoryUsage(47150)
#2 /var/www/dev/tests/integration/framework/Magento/TestFramework/MemoryLimit.php(127): Magento\TestFramework\Helper\Memory->getRealMemoryUsage()
#3 /var/www/dev/tests/integration/framework/Magento/TestFramework/MemoryLimit.php(59): Magento\TestFramework\MemoryLimit->_getUsage()
#4 /var/www/dev/tests/integration/framework/Magento/TestFramework/Bootstrap/Memory.php(50): Magento\TestFramework\MemoryLimit->printStats()
#5 [internal function]: Magento\TestFramework\Bootstrap\Memory->displayStats()
#6 {main}

Next Magento\Framework\Exception\LocalizedException: Command returned non-zero exit code:
`ta in /var/www/vendor/magento/framework/Shell.php on line 64

Fatal error: Uncaught Exception: sh: tasklist.exe: not found in /var/www/vendor/magento/framework/Shell.php:63
Stack trace:
#0 /var/www/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php(92): Magento\Framework\Shell->execute('tasklist.exe /f...', Array)
#1 /var/www/dev/tests/integration/framework/Magento/TestFramework/Helper/Memory.php(58): Magento\TestFramework\Helper\Memory->_getWinProcessMemoryUsage(47150)
#2 /var/www/dev/tests/integration/framework/Magento/TestFramework/MemoryLimit.php(127): Magento\TestFramework\Helper\Memory->getRealMemoryUsage()
#3 /var/www/dev/tests/integration/framework/Magento/TestFramework/MemoryLimit.php(59): Magento\TestFramework\MemoryLimit->_getUsage()
#4 /var/www/dev/tests/integration/framework/Magento/TestFramework/Bootstrap/Memory.php(50): Magento\TestFramework\MemoryLimit->printStats()
#5 [internal function]: Magento\TestFramework\Bootstrap\Memory->displayStats()
#6 {main}

Next Magento\Framework\Exception\LocalizedException: Command returned non-zero exit code:
`ta in /var/www/vendor/magento/framework/Shell.php on line 64

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 20 (11 by maintainers)

Most upvoted comments

@ihor-sviziev Thanks so much for the fix. It looks like it has done the trick!

I have PhpUnit v9.3.10.

However, I would like to stress, even though you got a different error, this is still a problem and needs to be resolved: https://github.com/magento/magento2/issues/30146#issuecomment-697179224

The reason you have produced a different error to mine, might be because the command you ran, was slightly different to mine.

The command you ran: ../../../vendor/phpunit/phpunit/phpunit --configuration phpunit.xml ./testsuite/Magento/IntegrationTest.php The command I ran: ../../../vendor/phpunit/phpunit/phpunit --configuration phpunit.xml