ENHANCEMENT Added SapphireTest->usesDatabase flag to explicitly request building of a test database for a test suite. This is necessitated by r93717, which removed the automatic building of these databases on every run.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@93975 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-11-30 01:48:26 +00:00
parent b9bbecdbee
commit ba344f2531
2 changed files with 10 additions and 1 deletions

View File

@ -22,6 +22,13 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
*/
static $fixture_file = null;
/**
* @var Boolean If set to TRUE, this will force a test database to be generated
* in {@link setUp()}. Note that this flag is overruled by the presence of a
* {@link $fixture_file}, which always forces a database build.
*/
protected $usesDatabase = null;
protected $originalMailer;
protected $originalMemberPasswordValidator;
protected $originalRequirements;
@ -70,7 +77,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
$fixtureFile = eval("return {$className}::\$fixture_file;");
// Set up fixture
if($fixtureFile) {
if($fixtureFile || $this->usesDatabase) {
if(substr(DB::getConn()->currentDatabase(),0,5) != 'tmpdb') {
//echo "Re-creating temp database... ";
self::create_temp_db();

View File

@ -4,6 +4,8 @@
* @subpackage tests
*/
class CheckboxFieldTest extends SapphireTest {
protected $usesDatabase = true;
function testFieldValueTrue() {
/* Create the field, and set the value as boolean true */