I'd like to integrate PHPUnit to my framework. By this, I mean that I have to do some initializing in the beginning, like setting up autoloads, before I'd run the tests.
I'd like to use the cli test runner, and if I understand correctly, I have to make a class, that has a static function suite(), which returns an instance of PHPUnit_Framework_TestSuite, and add tests to this suite, as noted on http://www.phpunit.de/manual/current/en/textui.html.
So far I have come up with:
class MyTestFW {
public static function suite() {
// Do framework initialization here
$suite = new PHPUnit_Framework_TestSuite();
$suite->addTest(new SimpleTest());
// Add more tests
return $suite;
}
}
SimpleTest is a very basic test class, that extends PHPUnit_Framework_TestCase. When I run "phpunit MyTestFW", I always get:
PHPUnit 3.3.16 by Sebastian Bergmann.
E
Time: 0 seconds
There was 1 error:
1) (SimpleTest)
RuntimeException: PHPUnit_Framework_TestCase::$name must not be NULL.
Could someone help me out a little please?