NetBeans中的PHPUnit代码覆盖率因Yaml依赖性而失败

时间:2014-02-19 08:31:41

标签: netbeans phpunit code-coverage xdebug

我试图让NetBeans中的代码覆盖率正常工作,但我仍然遇到PHPUnit给我的错误:

"/usr/bin/php" "/usr/bin/phpunit" "--colors" "--log-junit" "/tmp/nb-phpunit-log.xml" "--bootstrap" "/home/btekielski/Dokumenty/Projects/PlanQ/src/tests/bootstrap.php" "--coverage-clover" "/tmp/nb-phpunit-coverage.xml" "/usr/local/netbeans-7.4/php/phpunit/NetBeansSuite.php" "--run=/home/btekielski/Dokumenty/Projects/PlanQ/src/tests"
PHPUnit 3.7.28 by Sebastian Bergmann.

PHP Fatal error:  Uncaught exception 'PHPUnit_Framework_Error_Warning' with message 'include_once(Symfony/Component/Yaml/Yaml.class.php): failed to open stream: No such file or directory' in /home/user/Projects/src/tests/bootstrap.php:65
Stack trace:

我在bootstrap中有一个自定义自动加载器功能,如下所示:

function loadClass($class) {
    if (empty($class) || $class == 'parent') {
        return;
    }
    $throw = false;

    if (strpos($class, 'PHPExcel') !== false) {
        return;
    }

    $file = str_replace('\\', DIRECTORY_SEPARATOR, $class) . CLASS_FILE_EXTENSION;
    include_once($file);

    if (!class_exists($class, false) && !interface_exists($class, false)) {
        if ($throw) {
            trigger_error(
                    "Class file '" . $file . "' do not provide class '" .
                    $class . "'", E_USER_ERROR
            );
        }

        return;
    }
}

我很感激任何提示......

1 个答案:

答案 0 :(得分:1)

您调用的include_once()具有Symphony的相对路径,表示它位于当前目录下方。是这种情况,还是你在这个相对路径工作的错误目录?