How to get NetBeans PHPUnit coverage for Windows?

I am trying to get Netbeans to check for code coverage . I work with PHP in setting up Windows XAMPP and installing PHPUnit, which seems to work just fine for doing unit tests.

When I right-click my project and select Code Cover> Collect and Display Code, it displays the bottom panel at the bottom of "0%" and has options for running tests and receiving a report.

I run tests and check the report, but it remains at 0%. If I check the report, he says: "There is no data - are you still running your code?" I tried to repeat the tests, but he still does. I also tried just starting the project, and also debug the project to no avail.

Recent information on this topic is hard to find, but judging by the PHPUnit documentation, it may be a problem with Xdebug (I have included it, but I don’t know if it works properly since I have not used it from Netbeans before). Some old sources say that there are two php.ini in Xampp (one for the web interface, one for the CLI), but I cannot find the second (suppose it has changed since then).

I'm sure that I probably missed something pretty simple, like Xdebug or something ... any help?

Here is the XDebug section from my php / php.ini file:

[XDebug] zend_extension = "D:\xampp\php\ext\php_xdebug.dll" ;xdebug.profiler_append = 0 ;xdebug.profiler_enable = 1 ;xdebug.profiler_enable_trigger = 0 ;xdebug.profiler_output_dir = "\xampp\tmp" ;xdebug.profiler_output_name = "cachegrind.out.%t-%s" xdebug.remote_enable = 1 xdebug.remote_handler = "dbgp" xdebug.remote_host = "127.0.0.1" ;xdebug.trace_output_dir = "\xampp\tmp" 
+4
source share
1 answer

Probably caused by this: http://forums.netbeans.org/topic47374.html . Apparently, PHPUnit cannot handle running c: \ and testing something on D :.

Therefore, I run any tests in which I want to receive coverage reports from the command line using the -coverage-html / path / to / directory argument:

 phpunit --bootstrap bootstrap.php --configuration phpunit.xml --coverage-html ./report ./unit 

If the last argument (./unit) means it will check the als tests in the unit / subdirectory.

+6
source

All Articles