I have a Zend Framework project, and want to using unit testing to test it.
In tests folder, I have the phpunit.xml
as following;
I was having the same problem with the same setup. From what I understand, more recent versions of PHPUnit require at least one actual test to run properly. After creating a simple test, it worked.
myProject/tests/application/DemoTest.php
<?php
class DemoTest extends ControllerTestCase
{
public function setUp() {
parent::setUp();
}
public function testCanDoUnitTest() {
$this->assertTrue(true);
}
}
I noticed that you're not using the <testsuites>
which contains multiple occurences of <testsuite>
.
Here is my phpunit.xml which works fine for Zend Framework projects:
<testsuites>
<testsuite name="UnitTests">
<directory>./library</directory>
</testsuite>
<testsuite name="ApplicationTests">
<directory>./application</directory>
</testsuite>
</testsuites>
Youll notice its throwing the exception because its looking for a file named the same as the name
you provided for your test suite. You need to actually write a test suite and then supply the name of that test suite to your config: http://www.phpunit.de/manual/3.2/en/organizing-test-suites.html