mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR tests can now require default records on classes
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@101025 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
e9d9c7d84c
commit
8764524695
@ -33,6 +33,13 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
protected static $is_running_test = false;
|
protected static $is_running_test = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* By default, setUp() does not require default records. Pass
|
||||||
|
* class names in here, and the require/augment default records
|
||||||
|
* function will be called on them.
|
||||||
|
*/
|
||||||
|
protected $requireDefaultRecordsFrom = array();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of extensions that can't be applied during the execution of this run. If they are
|
* A list of extensions that can't be applied during the execution of this run. If they are
|
||||||
@ -121,6 +128,12 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
|||||||
|
|
||||||
self::empty_temp_db();
|
self::empty_temp_db();
|
||||||
|
|
||||||
|
foreach($this->requireDefaultRecordsFrom as $className) {
|
||||||
|
$instance = singleton($className);
|
||||||
|
if (method_exists($instance, 'requireDefaultRecords')) $instance->requireDefaultRecords();
|
||||||
|
if (method_exists($instance, 'augmentDefaultRecords')) $instance->augmentDefaultRecords();
|
||||||
|
}
|
||||||
|
|
||||||
if($fixtureFile) {
|
if($fixtureFile) {
|
||||||
$fixtureFiles = (is_array($fixtureFile)) ? $fixtureFile : array($fixtureFile);
|
$fixtureFiles = (is_array($fixtureFile)) ? $fixtureFile : array($fixtureFile);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user