Code crash with PHPUnit and Zend Framework

I have some problems with code coverage reports in PHPunit and zend framework. Whenever I run a phpunit test, code coverage does not return the following message:


PHPUnit 3.4.15 by Sebastian Bergmann.

I.......III.I................................IIIIIIIIIIIIIII 60 / 93
IIII....I....I..II..II.....IIIIII

Time: 4 seconds, Memory: 22.25Mb

OK, but incomplete or skipped tests!
Tests: 93, Assertions: 174, Incomplete: 36.

Generating code coverage report, this may take a moment.PHP Fatal error:  Cannot redeclare class Klunde_Auth in /Users/kristianlunde/workspaces/private/klunde/Library/Klunde/Auth.php on line 9

Fatal error: Cannot redeclare class Klunde_Auth in /Users/kristianlunde/workspaces/private/klunde/Library/Klunde/Auth.php on line 9

My phpunit.xml file looks like this:


<phpunit bootstrap="./application/bootstrap.php" colors="true">
 <testsuite name="Klunde">
  <directory>./application/</directory>
  <directory>./Library/Klunde</directory>
 </testsuite>

 <filter>
  <whitelist>
   <directory suffix=".php">../application</directory>
   <directory suffix=".php">../Library/Klunde</directory>
   <exclude>
    <directory suffix=".phtml">../application/</directory>
    <file>../application/Bootstrap.php</file>
             <file>../application/controllers/ErrorController.php</file>
            </exclude>
  </whitelist>
 </filter>

 <logging>
  <log type="coverage-html" target="./log/report" charset="UTF-8" yui="true"
   highlight="true" lowUpperBound="50" highLowerBound="80" />

  <log type="testdox-html" target="./log/testdox.html" />
 </logging>
</phpunit>

I did

var_dump(get_included_files());

at the top of the Auth file, and he tried to include the file more than once before it failed.

I also tried deleting the Klunde_Auth.php file to see if this was a single file problem, but then this error is triggered in the next file in the Library / Klunde directory.

I am running OSX Snow Leopard, with PHP 5.3.1, XDebug 2.1.0beta3 and PHPUnit 3.4.15

All help and help would be greatly appreciated.

Thank.

+3
1

debug_print_backtrace() Klunde_Auth.php, .

testuite, , , / , .

+2

Source: https://habr.com/ru/post/1758599/


All Articles