Shopware tests failing

Hi guys

 

I’m trying to configure a CI on my shopware project and the idea is running the shopware tests and my plugin tests during this process. But, when I try to run Shopware tests I got errors like:

vagrant@dev:/var/www/shopware/current/tests$ ./../vendor/bin/phpunit 
PHPUnit 5.6.1 by Sebastian Bergmann and contributors.

Runtime: PHP 7.0.11-1~dotdeb+8.1 with Xdebug 2.4.1
Configuration: /var/www/shopware/releases/00000000000000/htdocs/tests/phpunit.xml.dist

............................................................. 61 / 1218 ( 5%)
............................................................. 122 / 1218 ( 10%)
............................................................. 183 / 1218 ( 15%)
............................................................E 244 / 1218 ( 20%)
EEEEE.......................................FFFFFFFF.F.EEEEEE 305 / 1218 ( 25%)
EE................EFFE.FFFEESPHP Fatal error: Uncaught Doctrine\ORM\ORMException: The EntityManager is closed. in /var/www/shopware/releases/00000000000000/htdocs/vendor/doctrine/orm/lib/Doctrine/ORM/ORMException.php:144
Stack trace:
#0 /var/www/shopware/releases/00000000000000/htdocs/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(741): Doctrine\ORM\ORMException::entityManagerClosed()
#1 /var/www/shopware/releases/00000000000000/htdocs/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(354): Doctrine\ORM\EntityManager->errorIfClosed()
#2 /var/www/shopware/releases/00000000000000/htdocs/tests/Functional/Bundle/AccountBundle/Service/RegisterServiceTest.php(95): Doctrine\ORM\EntityManager->flush()
#3 /var/www/shopware/releases/00000000000000/htdocs/vendor/phpunit/phpunit/src/Framework/TestSuite.php(758): Shopware\Tests\Functional\Bundle\AccountBundle\Service\RegisterServiceTest::tearDownAfterClass()
#4 /var/www/shopware/releases/00000000000000/htdocs/vendor/phpunit/phpunit/src/Framework/TestSuite.php(753): PHPUnit_Framework_TestSuite->run(Object in /var/www/shopware/releases/00000000000000/htdocs/vendor/doctrine/orm/lib/Doctrine/ORM/ORMException.php on line 144

Fatal error: Uncaught Doctrine\ORM\ORMException: The EntityManager is closed. in /var/www/shopware/releases/00000000000000/htdocs/vendor/doctrine/orm/lib/Doctrine/ORM/ORMException.php on line 144

Doctrine\ORM\ORMException: The EntityManager is closed. in /var/www/shopware/releases/00000000000000/htdocs/vendor/doctrine/orm/lib/Doctrine/ORM/ORMException.php on line 144

Call Stack:
    0.0002 355752 1. {main}() /var/www/shopware/releases/00000000000000/htdocs/vendor/phpunit/phpunit/phpunit:0
    0.0092 2711096 2. PHPUnit_TextUI_Command::main() /var/www/shopware/releases/00000000000000/htdocs/vendor/phpunit/phpunit/phpunit:47
    0.0092 2711208 3. PHPUnit_TextUI_Command->run() /var/www/shopware/releases/00000000000000/htdocs/vendor/phpunit/phpunit/src/TextUI/Command.php:115
    0.4663 36129848 4. PHPUnit_TextUI_TestRunner->doRun() /var/www/shopware/releases/00000000000000/htdocs/vendor/phpunit/phpunit/src/TextUI/Command.php:185
    0.4840 36372448 5. PHPUnit_Framework_TestSuite->run() /var/www/shopware/releases/00000000000000/htdocs/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:465
    4.1532 72279480 6. PHPUnit_Framework_TestSuite->run() /var/www/shopware/releases/00000000000000/htdocs/vendor/phpunit/phpunit/src/Framework/TestSuite.php:753
    4.1845 72594376 7. Shopware\Tests\Functional\Bundle\AccountBundle\Service\RegisterServiceTest::tearDownAfterClass() /var/www/shopware/releases/00000000000000/htdocs/vendor/phpunit/phpunit/src/Framework/TestSuite.php:758
    4.1845 72594376 8. Doctrine\ORM\EntityManager->flush() /var/www/shopware/releases/00000000000000/htdocs/tests/Functional/Bundle/AccountBundle/Service/RegisterServiceTest.php:95
    4.1845 72594376 9. Doctrine\ORM\EntityManager->errorIfClosed() /var/www/shopware/releases/00000000000000/htdocs/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:354

Can you help? 

 

Best

 

I don’t know why you do this. But nice to see an advanced programmer. Do you develop any modules? Or just testing vanilla shopware?

Hi,

a closed EM is usally an indicator for a previous query / statement failing and thus shutting down the EntityManager. So usually you should be able to debug this by looking for previous error messages in the Doctrine / SQL stack. At least that would be my first approach here.

Best regards,

Daniel