mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 15:05:32 +00:00
Make SiteTree reference conditional
This makes the boilerplate code compatible for testing framework-only sites.
This commit is contained in:
parent
8956b2d4fa
commit
81f292a2b5
@ -197,12 +197,14 @@ class FeatureContext extends SilverStripeContext {
|
||||
$factory->define('Member', $blueprint);
|
||||
|
||||
// Auto-publish pages
|
||||
foreach(\ClassInfo::subclassesFor('SiteTree') as $id => $class) {
|
||||
$blueprint = \Injector::inst()->create('FixtureBlueprint', $class);
|
||||
$blueprint->addCallback('afterCreate', function($obj, $identifier, &$data, &$fixtures) {
|
||||
$obj->publish('Stage', 'Live');
|
||||
});
|
||||
$factory->define($class, $blueprint);
|
||||
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) {
|
||||
$obj->publish('Stage', 'Live');
|
||||
});
|
||||
$factory->define($class, $blueprint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user