setFixtureFactory($this->getFixtureFactory()); $this->useContext('FixtureContext', $fixtureContext); // Add extra contexts with more steps $this->useContext('ThemeContext', new \SilverStripe\Cms\Test\Behaviour\ThemeContext($parameters)); // Use blueprints which auto-publish all subclasses of SiteTree $factory = $fixtureContext->getFixtureFactory(); foreach(\ClassInfo::subclassesFor('SiteTree') as $id => $class) { $blueprint = \Injector::inst()->create('FixtureBlueprint', $class); $blueprint->addCallback('afterCreate', function($obj, $identifier, &$data, &$fixtures) { /** @var \SiteTree $obj */ $obj->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE); }); $factory->define($class, $blueprint); } } }