diff --git a/dev/SapphireTest.php b/dev/SapphireTest.php index 0b4ec7fca..915203040 100755 --- a/dev/SapphireTest.php +++ b/dev/SapphireTest.php @@ -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(); diff --git a/tests/forms/CheckboxFieldTest.php b/tests/forms/CheckboxFieldTest.php index 6758940c7..4e02a73fd 100644 --- a/tests/forms/CheckboxFieldTest.php +++ b/tests/forms/CheckboxFieldTest.php @@ -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 */