W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
<phpunit>
元素的屬性用于配置 PHPUnit 的核心功能。
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.5/phpunit.xsd"
backupGlobals="true"
backupStaticAttributes="false"
<!--bootstrap="/path/to/bootstrap.php"-->
cacheTokens="false"
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
forceCoversAnnotation="false"
mapTestClassNameToCoveredClassName="false"
printerClass="PHPUnit_TextUI_ResultPrinter"
<!--printerFile="/path/to/ResultPrinter.php"-->
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
stopOnRisky="false"
testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader"
<!--testSuiteLoaderFile="/path/to/StandardTestSuiteLoader.php"-->
timeoutForSmallTests="1"
timeoutForMediumTests="10"
timeoutForLargeTests="60"
verbose="false">
<!-- ... -->
</phpunit>
以上 XML 配置對(duì)應(yīng)于在the section called “命令行選項(xiàng)”描述過的 TextUI 測(cè)試執(zhí)行器的默認(rèn)行為。
其他那些不能用命令行選項(xiàng)來配置的選項(xiàng)有:
convertErrorsToExceptions
默認(rèn)情況下,PHPUnit 將會(huì)安插一個(gè)錯(cuò)誤處理函數(shù)來將以下錯(cuò)誤轉(zhuǎn)換為異常:
E_WARNING
E_NOTICE
E_USER_ERROR
E_USER_WARNING
E_USER_NOTICE
E_STRICT
E_RECOVERABLE_ERROR
E_DEPRECATED
E_USER_DEPRECATED
將 convertErrorsToExceptions
設(shè)為 false
可以禁用此功能。
convertNoticesToExceptions
此選項(xiàng)設(shè)置為 false
時(shí),由 convertErrorsToExceptions
安插的錯(cuò)誤處理函數(shù)不會(huì)將 E_NOTICE
、E_USER_NOTICE
、E_STRICT
錯(cuò)誤轉(zhuǎn)換為異常。
convertWarningsToExceptions
此選項(xiàng)設(shè)置為 false
時(shí),由 convertErrorsToExceptions
安插的錯(cuò)誤處理函數(shù)不會(huì)將 E_WARNING
或 E_USER_WARNING
錯(cuò)誤轉(zhuǎn)換為異常。
forceCoversAnnotation
只記錄使用了 @covers
標(biāo)注(文檔參見the section called “@covers”)的測(cè)試的代碼覆蓋率。
timeoutForLargeTests
如果實(shí)行了基于測(cè)試規(guī)模的時(shí)間限制,那么此屬性為所有標(biāo)記為 @large
的測(cè)試設(shè)定超時(shí)限制。在配置的時(shí)間限制內(nèi)未執(zhí)行完畢的測(cè)試將視為失敗。
timeoutForMediumTests
如果實(shí)行了基于測(cè)試規(guī)模的時(shí)間限制,那么此屬性為所有標(biāo)記為 @medium
的測(cè)試設(shè)定超時(shí)限制。在配置的時(shí)間限制內(nèi)未執(zhí)行完畢的測(cè)試將視為失敗。
timeoutForSmallTests
如果實(shí)行了基于測(cè)試規(guī)模的時(shí)間限制,那么此屬性為所有未標(biāo)記為 @medium
或 @large
的測(cè)試設(shè)定超時(shí)限制。在配置的時(shí)間限制內(nèi)未執(zhí)行完畢的測(cè)試將視為失敗。
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: