Codeigniter3 フレームワークと phpunit パッケージci-phpunit-testを使用しています。Zendデバッガーを有効にして、zendサーバーでphpを実行します。
私のphpunit.xmlファイルはそこにあります:
<phpunit
bootstrap="./Bootstrap.php"
colors="true"
testsuite="CodeIgniter Application Test Suite">
<testsuites>
<testsuite name="CodeIgniter Application Test Suite">
<directory suffix="test.php">./</directory>
<exclude>./_ci_phpunit_test/</exclude>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">../controllers</directory>
<directory suffix=".php">../models</directory>
</whitelist>
</filter>
</phpunit>
緑の再生とダッシュが付いたアイコンを使用してコード カバレッジの実行を実行すると、次のコマンドが実行されます。
"C:\Program Files (x86)\Zend\ZendServer\bin\php.exe" -dzend_debugger.enable_coverage=1 C:/Users/NICOLAS/AppData/Local/Temp/ide-phpunit.php --configuration C:\....\phpunit.xml
すべてのテストを正常に実行した後、Coverage PHPUnit サイド バーが開き、0% のカバレッジのみが表示されます (テストでは多くのコードが実行されるはずです)。
ここに私が得るものがあります:
更新: いくつかの詳細情報... これを phpunit.xml ファイルに追加すると、Xdebug が有効になっていないことがわかります。
<logging>
<log type="coverage-html" target="build/coverage"/>
<log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
</logging>
したがって、xdebug デバッガーを有効にしてみましたが、テストの実行が非常に遅く、build/coverage フォルダーに HTML レポートが表示されました。良いですが、PHPStorm 環境には統合されていません。
そこで、zend デバッガーに戻り、PHPStorm 機能を試してみました (phpunit.xml のログ セクションを削除します)。テストはすぐに実行できますが、カバレッジは 0% のままです...