下面的配置 xml 配置來(lái)源于 composer 中的 phpunit.xml.dist 文件:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="tests/bootstrap.php"
>
<testsuites>
<testsuite name="Composer Test Suite">
<directory>./tests/Composer/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src/Composer/</directory>
</whitelist>
</filter>
</phpunit>
解釋?zhuān)?/p>
backupGlobals: 是否備份全局變量
backupStaticAttributes: 是否備份靜態(tài)屬性值
colors: 是否開(kāi)啟顏色輸出
convertErrorsToExceptions: 是否將 Errors 級(jí)別錯(cuò)誤轉(zhuǎn)成異常
convertNoticesToExceptions: 是否將 Notices 級(jí)別錯(cuò)誤轉(zhuǎn)成異常
convertWarningsToExceptions: 是否將 Warnings 級(jí)別錯(cuò)誤專(zhuān)程異常
processIsolation: 是否讓每個(gè)測(cè)試在單獨(dú)的 PHP 進(jìn)程中執(zhí)行
stopOnFailure: 在遇到失敗時(shí)是否停止執(zhí)行
syntaxCheck: 愈發(fā)檢測(cè)
bootstrap: 引導(dǎo)文件
<testsuite>: 測(cè)試套件
<testsuites>: 將測(cè)試套件進(jìn)行以及測(cè)試用例組合出新的測(cè)試套件
<filter> 和 <whitelist>: 用于配置代碼覆蓋率所使用的白名單