I have added some phpunit tests to my custom module. When trying to run them in I get this error:
Class '\Drupal\Tests\DocumentElement' not found I have copied core/phpunit.xml.dist to core/phpunit.xml and edited the URL and DB values but nothing else.
The command I'm running is
vendor/bin/phpunit -c web/core/phpunit.xml web/modules/contrib/my_module/.
It seems that the classloader is not working. What have I missed?
I'm using drupal 9 and phpunit 9. I've also tried with phpunit 7 and 8 but I get the same error.