Moodle 4.2.2+ (Build: 20230920)
Php: 8.1.2.1.2.14, pgsql: 14.9 (Debian 14.9-1.pgdg120+1), OS: Linux 6.2.0-1009-aws x86_64
PHPUnit 9.5.28 by Sebastian Bergmann and contributors.
...
11) report_customsql\external\external_get_users_test::test_get_users_site_config
Error: Class "external_api" not found
/var/www/site/report/customsql/classes/external/get_users.php:31
/var/www/site/lib/classes/component.php:144
/var/www/site/report/customsql/tests/external/external_get_users_test.php:73
/var/www/site/lib/phpunit/classes/advanced_testcase.php:94
an old version of the plugin was mistakenly checked out in our repo. After a rebase, all unit tests run without errors. Perhaps an update of the plugin will fix the error for you, as it did for us.
Please find details below: