Author: Stuart Herbert (stuart.herbert@datasift.com)
Example #1
0
 /**
  * set up any templated methods from a predefined class
  *
  * @return Story
  */
 public function basedOn(StoryTemplate $tmpl)
 {
     // tell the template which story it is being used with
     $tmpl->setStory($this);
     $tmpl->hasTestCanRunCheck() && $this->addTestCanRunCheck($tmpl->getTestCanRunCheck());
     $tmpl->hasTestSetup() && $this->addTestSetup($tmpl->getTestSetup());
     $tmpl->hasTestTeardown() && $this->addTestTeardown($tmpl->getTestTeardown());
     $tmpl->hasPerPhaseSetup() && $this->addPerPhaseSetup($tmpl->getPerPhaseSetup());
     $tmpl->hasPerPhaseTeardown() && $this->addPerPhaseTeardown($tmpl->getPerPhaseTeardown());
     $tmpl->hasDeviceSetup() && $this->addDeviceSetup($tmpl->getDeviceSetup());
     $tmpl->hasDeviceTeardown() && $this->addDeviceTeardown($tmpl->getDeviceTeardown());
     $tmpl->hasHints() && $this->addHints($tmpl->getHints());
     $tmpl->hasPreTestPrediction() && $this->addPreTestPrediction($tmpl->getPreTestPrediction());
     $tmpl->hasPreTestInspection() && $this->addPreTestInspection($tmpl->getPreTestInspection());
     $tmpl->hasAction() && $this->addAction($tmpl->getAction());
     $tmpl->hasPostTestInspection() && $this->addPostTestInspection($tmpl->getPostTestInspection());
     // remember this template for future use
     $this->storyTemplates[] = $tmpl;
     // Return $this for a fluent interface
     return $this;
 }