@magentoDbIsolation triggers fatal errors
-
16-02-2021 - |
سؤال
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
لا تنتمي إلى magento.stackexchange