mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
b9bbecdbee
commit
ba344f2531
@ -22,6 +22,13 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
|||||||
*/
|
*/
|
||||||
static $fixture_file = null;
|
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 $originalMailer;
|
||||||
protected $originalMemberPasswordValidator;
|
protected $originalMemberPasswordValidator;
|
||||||
protected $originalRequirements;
|
protected $originalRequirements;
|
||||||
@ -70,7 +77,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
|||||||
$fixtureFile = eval("return {$className}::\$fixture_file;");
|
$fixtureFile = eval("return {$className}::\$fixture_file;");
|
||||||
|
|
||||||
// Set up fixture
|
// Set up fixture
|
||||||
if($fixtureFile) {
|
if($fixtureFile || $this->usesDatabase) {
|
||||||
if(substr(DB::getConn()->currentDatabase(),0,5) != 'tmpdb') {
|
if(substr(DB::getConn()->currentDatabase(),0,5) != 'tmpdb') {
|
||||||
//echo "Re-creating temp database... ";
|
//echo "Re-creating temp database... ";
|
||||||
self::create_temp_db();
|
self::create_temp_db();
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
*/
|
*/
|
||||||
class CheckboxFieldTest extends SapphireTest {
|
class CheckboxFieldTest extends SapphireTest {
|
||||||
|
|
||||||
|
protected $usesDatabase = true;
|
||||||
|
|
||||||
function testFieldValueTrue() {
|
function testFieldValueTrue() {
|
||||||
/* Create the field, and set the value as boolean true */
|
/* Create the field, and set the value as boolean true */
|
||||||
$field = new CheckboxField('IsChecked', 'Checked');
|
$field = new CheckboxField('IsChecked', 'Checked');
|
||||||
|
Loading…
Reference in New Issue
Block a user