Make SiteTree reference conditional

This makes the boilerplate code compatible for testing
framework-only sites.
This commit is contained in:
Fred Condo 2014-07-16 17:01:45 -07:00
parent 8956b2d4fa
commit 81f292a2b5

View File

@ -197,6 +197,7 @@ class FeatureContext extends SilverStripeContext {
$factory->define('Member', $blueprint);
// Auto-publish pages
if (class_exists('SiteTree')) {
foreach(\ClassInfo::subclassesFor('SiteTree') as $id => $class) {
$blueprint = \Injector::inst()->create('FixtureBlueprint', $class);
$blueprint->addCallback('afterCreate', function($obj, $identifier, &$data, &$fixtures) {
@ -205,6 +206,7 @@ class FeatureContext extends SilverStripeContext {
$factory->define($class, $blueprint);
}
}
}
public function setMinkParameters(array $parameters) {
parent::setMinkParameters($parameters);