PHPUnit 在线中文手册
https://phpunit.readthedocs.io/zh_CN/latest/index.html
laravel 设置代码覆盖率统计,
安装好php xdebug 扩展,同时 php.ini 增加
xdebug.mode=coverage
phpunit.xml <phpunit> 标记内增加如下代码
<logging>
<log type="coverage-html" target="./test-result/report" lowUpperBound="35"
highLowerBound="70"/>
</logging>
要运行测试套件,用 --testsuite
选项:
$ phpunit --testsuite money
可以明确指定测试的执行顺序:
示例 用 XML 配置来编排测试套件
<phpunit bootstrap="src/autoload.php"> ... <testsuites> <testsuite name="money"> <file>tests/IntlFormatterTest.php</file> <file>tests/MoneyTest.php</file> <file>tests/CurrencyTest.php</file> </testsuite> </testsuites> .... </phpunit>