When running integration tests for my custom Magento module, usage of the annotation @magentoDbIsolation causes this error to be logged:

PHP Fatal error:  Uncaught Doctrine\Common\Annotations\AnnotationException: [Semantical Error] The annotation "@magentoDBIsolation" in method \<module>\Test\Integration\Test::testXXXX() was never imported. Did you maybe forget to add a "use" statement for this annotation? in /var/vstsagent/_work/14/a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php:54

I have Magento 2.3-develop branch installed locally. I'm running PHP 7.2.10 and PHPUnit 6.5.14.

I can run Magento's core tests (which have this annotation) without issue - so what might this be? Are there some cases where adding @magentoDBIsolation enabled is not valid, based on the behaviour of the test? Could this cause the above error?

Note, there are some tests in this module which use the annotation, and do not trigger an error. I just can't understand why some would fail and others not.


It seems you have an typo in the annotation, correct value should be @magentoDbIsolation

  • It is an answer because the question is, "why is this not working" and the answer could potentially be "I've spelled it wrong". Investigating. Jun 4 '19 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.