Search code examples
doctrinephpunitphpstormmagento2allure

Unable to execute PHPUnit Tests in Adobe Commerce (Magento 2)


I’m running a local Docker instance of Adobe Commerce (Magento 2) with the following versions:

Magento Enterprise version 2.4.3-p3 
phpunit/phpunit version 9.5.28
doctrine/annotations version 2.0.0
allure-framework/allure-php-api version 1.4.0

I’m unable to run PHPUnit tests in PhpStorm (Build #PS-223.8214.64)

The error I’m getting is the following:

Call to undefined method Doctrine\Common\Annotations\AnnotationRegistry::registerUniqueLoader()

Searching for registerUniqueLoader in the vendor directory, I’m seeing the following in Yandex\Allure\Adapter\Annotation\AnnotationProvider:: registerAnnotationNamespaces()

public static function registerAnnotationNamespaces()
{
    AnnotationRegistry::registerUniqueLoader('class_exists');
}

However, class Doctrine\Common\Annotations\AnnotationRegistry only has methods reset() and loadAnnotationClass().

Is there a set of module versions I need to be at in order to be able to run PHPUnit tests? Thanks in advance for the help.


Solution

  • Try to change doctrine/annotations version to 1.14.2 in composer.json. It works for me.