Discussion of testing theory and practice, including methodologies (such as TDD, BDD, DDD, Agile, XP) and software - anything to do with testing goes here. (Formerly "The Testing Side of Development")
I'm having a hard time finding out how to share my db connection. The phpunit manual addresses this topic but I don't know enough about phpunit to know how to implement it. Or I'm just not getting it.
class Lib_AllTests extends PHPUnit_Framework_TestSuite {
protected function setUp() {
$this->sharedFixture = *mydatabaseconnection*;
}
public static function main() {
PHPUnit_TextUI_TestRunner::run(self::suite());
}
public static function suite() {
$suite = new PHPUnit_Framework_TestSuite('My Library');
$suite->addTest(Lib_Package_AllTests::main());
return $suite;
}
}
The manual says this should be enough to have the sharedFixture available in the other tests (Lib_Package_AllTests). But it doesn't work.