I have tried to execute phpunit with xdebug for code coverage as below,
C:\wamp\bin\php\php5.3.22>phpunit -coverage-html /tmp C:\<unittest file pat>\TestRetainer.php
and it is giving output as follows,
PHPUnit 3.7.32 by Sebastian Bergmann.
....
Time: 36 ms, Memory: 5.75Mb
OK (4 tests, 12 assertions)
C:\wamp\bin\php\php5.3.22>
But i am unable to find the html version of report file.
I had gone through this url http://phpunit.de/manual/current/en/phpunit-book.html#code-coverage-analysis. But i do not find any luck.
Please help me on this.
For Linux, run command in the project root.
./vendor/bin/phpunit --coverage-html reports/
This will create a folder named reports in your project root.
For Windows:
C:\wamp\bin\php\php5.3.22>phpunit --coverage-html tmp C:\<unittest file pat>\TestRetainer.php
This will create a tmp folder inside php5.3.22, where your test report will generate.
Better if you keep reports inside your project root.
C:\wamp\htdocs\<project root> >phpunit --coverage-html tmp TestRetainer.php
It looks like you're mixing Linux paths and windows paths:
C:\wamp\bin\php\php5.3.22>phpunit --coverage-html /tmp C:\<unittest file pat>\TestRetainer.php
You're trying to write the coverage files to a folder called /tmp
. On a Linux system this is a folder called tmp
in the root of the drive. Change that to a Windows path (C:\tmp
maybe?) and it should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With