使用PHPUnit 8.5运行多个目录

问题描述

如果我要运行目录中的所有测试文件,则可以运行PHPunit tests/path/to/directory。但是,如果运行PHPunit tests/path/1 tests/path/21都是包含测试文件的目录的2,它将抱怨Fatal error: Uncaught PHPUnit\Runner\Exception: Class 'tests/path/1' Could not be found。如何在一个命令中同时运行两个目录?

解决方法

最佳做法是不要在CLI上使用路径调用PHPUnit测试运行程序,而是在XML配置文件中配置路径。