开发者

Running phpunit with no arguments after installing Xdebug via PECL generates warnings about permissions

开发者 https://www.devze.com 2023-04-12 07:29 出处:网络
I am running Zend Framework 1.10 on Ubuntu 10.04, just installed Xdebug to generate code coverage, via PECL.

I am running Zend Framework 1.10 on Ubuntu 10.04, just installed Xdebug to generate code coverage, via PECL.

If I run phpunit like so:

$ phpunit --coverage-html ~/coverage

It works just fine. Unittests run, then code coverage output is generated. No error messages or warnings.

But if I do:

$ phpunit

The tests run fine, but when code coverage begins, I get this:

Generating code coverage report, this may take a moment.PHP Warning:  mkdir(): Permission denied in /usr/share/php/PHPUnit/Util/Filesystem.php on line 209
PHP Stack trace:
PHP   1. {main}() /usr/bin/phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:52
PHP   3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:147
PHP   4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/php/PHPUnit/TextUI/Command.php:214
PHP   5. PHPUnit_Util_Report::render() /usr/share/php/PHPUnit/TextUI/TestRunner.php:479
PHP   6. PHPUnit_Util_Filesystem::getDirectory() /usr/share/php/PHPUnit/Util/Report.php:87
PHP   7. mkdir() /usr/share/php/PHPUnit/Util/Filesystem.php:209

Warning: mkdir(): Permission denied in /usr/share/php/PHPUnit/Util/Filesystem.php on line 209

Call Stack:
    0.0003     322324   1. {main}() /usr/bin/phpunit:0
    0.0521    4658252   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:52
    0.0521    4658716   3. PHPUnit_TextU开发者_Python百科I_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:147
    0.5944   12773356   4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/php/PHPUnit/TextUI/Command.php:214
   37.1550   24746768   5. PHPUnit_Util_Report::render() /usr/share/php/PHPUnit/TextUI/TestRunner.php:479
   37.1550   24746768   6. PHPUnit_Util_Filesystem::getDirectory() /usr/share/php/PHPUnit/Util/Report.php:87
   37.1560   24746984   7. mkdir() /usr/share/php/PHPUnit/Util/Filesystem.php:209

Before I installed Xdebug, running phpunit without any arguments worked just fine.

I presume this is just a silly permissioning problem stemming from my PECL installation of Xdebug, but it looks like everything in /usr/share/php/phpunit is supposed to be permissioned as root, soooooo...any ideas?


The error message just tells you that mkdir can't create a folder somewhere but not where it is trying to do so.

I would assume you have an phpunit.xml.dist in which a <logger> of the type coverage-html is defined with a target that doesn't exist on your machine which your current user doesn't have write access too.

PHPUnit doesn't try to generate a coverage report without somneone telling it do and if you don't do it on the cli a phpunit.xml is the only option left.

0

精彩评论

暂无评论...
验证码 换一张
取 消