Can I ask the most basic question? Are you running the tests according to https://docs.moodle.org/dev/PHPUnit ?
(I mean, this should just work, and it does for most people.)
(I mean, this should just work, and it does for most people.)