コード例 #1
0
 /**
  * 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);
     // Override existing fixture context with more specific one
     $fixtureContext = new FixtureContext($parameters);
     $fixtureContext->setFixtureFactory($this->getFixtureFactory());
     $this->useContext('FixtureContext', $fixtureContext);
 }
コード例 #2
0
ファイル: FeatureContext.php プロジェクト: tcaiger/mSupplyNZ
 /**
  * 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);
     // Override existing fixture context with more specific one
     $fixtureContext = new \SilverStripe\Cms\Test\Behaviour\FixtureContext($parameters);
     $fixtureContext->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) {
             $obj->publish('Stage', 'Live');
         });
         $factory->define($class, $blueprint);
     }
 }