mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Merge pull request #58 from oddnoc/safe-sitetree
Make SiteTree reference conditional in InitProcessor
This commit is contained in:
commit
bf36edecad
@ -197,13 +197,15 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setMinkParameters(array $parameters) {
|
||||
|
Loading…
Reference in New Issue
Block a user