Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

phpunit -coverage-html report path

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.

like image 905
Raja Avatar asked Apr 01 '14 18:04

Raja


2 Answers

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
like image 143
Anurag Prashant Avatar answered Sep 21 '22 13:09

Anurag Prashant


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.

like image 25
Kryten Avatar answered Sep 18 '22 13:09

Kryten