Answer the question
In order to leave comments, you need to log in
Code coverage calculation not working when using phpUnit from under Netbeans
Hello.
Such a problem. There is a machine under Windows 7 64bit, the latest PHP 5.5.3 is installed, PEAR is installed to it and phpUnit version 3.7.24 is installed from under it. I created an empty project in Netbeans 7.3.1, it contains an example file
Calculator.php of the form:
==
<?php class Calculator { /** * assert (0,0) == 0 * assert (0,1) == 1 * assert (1,0) == 1 * assert (1,1) == 2 * assert (1, 2) == 3 * */ public function sum($a, $b) { return $a + $b; } }
Answer the question
In order to leave comments, you need to log in
Same error.
The problem occurs if the project directory is set to a different drive.
The solution
is simple:
Move the project to the disk where netbeans is installed.
complex:
in the directory we create a file with the following content:
<?php
class NetBeansSuite extends PHPUnit_Framework_TestSuite {
public static function suite() {
$suite = new NetBeansSuite();
$array=self::rglob("*[Tt]est.php", getcwd());
foreach ($array as $file) {
$suite->addTestFile($file);
}
return $suite;
}
private static function rglob($pattern = '*', $path = '', $flags = 0) {
$paths = glob($path.'*', GLOB_MARK | GLOB_ONLYDIR | GLOB_NOSORT) or array();
$files = glob($path.$pattern, $flags) or array();
foreach ($paths as $path) {
$files = array_merge($files, self::rglob($pattern, $path, $flags));
}
return $files;
}
}
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question