12
votes

I use phpUnit on a integration server to run all tests and if I launch phpunit command from the command line, I receive:

PHPUnit 3.2.18 by Sebastian Bergmann.
F..III..I......I.IIII...
Time: 6 seconds
There was 1 failure:

1) Warning(PHPUnit_Framework_Warning)
No tests found in class "TU".
FAILURES
Tests: 24, Failures: 1, Incomplete: 9.

Via apache, running the same test file:

PHPUnit 3.2.18 by Sebastian Bergmann.
..III..I......I.IIII...
Time: 7 seconds

OK, but incomplete or skipped tests!
Tests: 23, Incomplete: 9.

My TU class just include all tests classes with a $suite->addTestFile(), and which have two static functions: main() which run all the tests, and suite() which return the tests suite. But the TU class is not in the primary file given as parameter to phpunit command, it's a generic class which scan files and list all test class.

I have the same problem with a class which extends PHPUnit_Framework_TestCase to add specific assert(), which is not included via $suite->addTestFile() but only by a require().

How can I correct this?

2

2 Answers

36
votes

For the class wich extends PHPUnit_Framework_TestCase, it should be abstract, and the warning disapear. For the first problem, it seems it is a bug.

0
votes

Looks like you are using two different php.ini files for command line and Apache.

On most unixoid systems, running

diff /etc/php*/*/php.ini

should show you the differences.

On Windows systems, use the search to find files named php.ini. In most cases, you can just copy the Apache configuration file to the CLI one.