/**
  * Initializes context.
  * Every scenario gets it's own context object.
  *
  * @param array $parameters context parameters (set them up through behat.yml)
  */
 public function __construct(array $parameters)
 {
     parent::__construct($parameters);
     $this->useContext('BasicContext', new BasicContext($parameters));
     $this->useContext('LoginContext', new LoginContext($parameters));
     $this->useContext('CmsFormsContext', new CmsFormsContext($parameters));
     $this->useContext('CmsUiContext', new CmsUiContext($parameters));
     $fixtureContext = new FixtureContext($parameters);
     $fixtureContext->setFixtureFactory($this->getFixtureFactory());
     $this->useContext('FixtureContext', $fixtureContext);
     // Use blueprints to set user name from identifier
     $factory = $fixtureContext->getFixtureFactory();
     $blueprint = \Injector::inst()->create('FixtureBlueprint', 'Member');
     $blueprint->addCallback('beforeCreate', function ($identifier, &$data, &$fixtures) {
         if (!isset($data['FirstName'])) {
             $data['FirstName'] = $identifier;
         }
     });
     $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);
     }
 }
 /**
  * Initializes context.
  * Every scenario gets it's own context object.
  *
  * @param   array   $parameters     context parameters (set them up through behat.yml)
  */
 public function __construct(array $parameters)
 {
     $this->useContext('BasicContext', new BasicContext($parameters));
     $this->useContext('LoginContext', new LoginContext($parameters));
     $this->useContext('CmsFormsContext', new CmsFormsContext($parameters));
     $this->useContext('CmsUiContext', new CmsUiContext($parameters));
     $this->useContext('EmailContext', new EmailContext($parameters));
     parent::__construct($parameters);
 }
 /**
  * Initializes context.
  * Every scenario gets it's own context object.
  *
  * @param array $parameters context parameters (set them up through behat.yml)
  */
 public function __construct(array $parameters)
 {
     parent::__construct($parameters);
     $this->useContext('BasicContext', new BasicContext($parameters));
     $this->useContext('LoginContext', new LoginContext($parameters));
     $this->useContext('CmsFormsContext', new CmsFormsContext($parameters));
     $this->useContext('CmsUiContext', new CmsUiContext($parameters));
     $this->useContext('EmailContext', new EmailContext($parameters));
     $fixtureContext = new FixtureContext($parameters);
     $fixtureContext->setFixtureFactory($this->getFixtureFactory());
     $this->useContext('FixtureContext', $fixtureContext);
     // Use blueprints to set user name from identifier
     $factory = $fixtureContext->getFixtureFactory();
     $blueprint = \Injector::inst()->create('FixtureBlueprint', 'Member');
     $blueprint->addCallback('beforeCreate', function ($identifier, &$data, &$fixtures) {
         if (!isset($data['FirstName'])) {
             $data['FirstName'] = $identifier;
         }
     });
     $factory->define('Member', $blueprint);
 }