Permalink
Browse files

ENHANCEMENT Added SapphireTest->usesDatabase flag to explicitly reque…

…st 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
  • Loading branch information...
1 parent b9bbecd commit ba344f25319031ad0f01f80ebd4a651f6291cae3 @chillu chillu committed Nov 30, 2009
Showing with 10 additions and 1 deletion.
  1. +8 −1 dev/SapphireTest.php
  2. +2 −0 tests/forms/CheckboxFieldTest.php
View
@@ -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 @@ function setUp() {
$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();
@@ -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 */

0 comments on commit ba344f2

Please sign in to comment.