0
我試圖設置phpunit來顯示我的項目的代碼覆蓋率。我按照谷歌上找到的例子,主要有以下設置:在laravel上運行帶有代碼覆蓋率的phpunit時的空目錄4.2項目
composer.json
"require-dev": {
"phpunit/phpunit": "5.*",
"phpunit/php-code-coverage": "^4.0.4",
"mockery/mockery": "^0.9.9"
},
phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
>
<testsuites>
<testsuite name="Application Test Suite">
<directory>./app/tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">app/</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="./report/" charset="UTF-8"
yui="true" highlight="false"
lowUpperBound="50" highLowerBound="80"/>
</logging>
</phpunit>
當我在宅基地運行所有測試VM
vendor/phpunit/phpunit/phpunit
測試運行但沒有代碼覆蓋年齡生成到「報告」目錄。它仍然是空的。
我在做什麼錯?
google上找到 - > just link * that *例如google改變了事物,你沒有共享搜索詞(和國家,IP,Android版本,你的谷歌歷史和什麼不是你的整個文件(生活)在線這將使谷歌的結果很明顯)。除此之外(真的只是鏈接它),看起來你並沒有將phpunit運行的輸出添加到問題中。 (1/2) – hakre
在第一槍時,我猜測你沒有啓用xdebug等等。沒有給出代碼覆蓋率。這被輸出爲「錯誤」,但不會被標記爲錯誤(可能是太多常見的錯誤,因此沒有這樣處理),因此不生成代碼覆蓋率報告。通常這與在'php.ini'中啓用xdebug一樣簡單,以便可以收集和報告代碼覆蓋率信息。 – hakre