setPersistDevice() public method

public setPersistDevice ( ) : void
return void
 public function initAfterModulesAvailable(StoryTeller $st, CliEngine $engine, Injectables $injectables)
 {
     // are we persisting the device?
     if (isset($engine->options->persistDevice) && $engine->options->persistDevice) {
         $st->setPersistDevice();
     }
 }
Example #2
0
 public function play(StoryTeller $st, Injectables $injectables)
 {
     // shorthand
     $output = $st->getOutput();
     // we're going to use this to play our setup and teardown phases
     $phasesPlayer = new PhaseGroup_Player();
     // load our story
     $story = Story_Loader::loadStory($this->storyFilename);
     $st->setStory($story);
     // does our story want to keep the test device open between
     // phases?
     if ($story->getPersistDevice()) {
         $st->setPersistDevice();
     }
     // set default callbacks up
     $story->setDefaultCallbacks();
     // make sure we start with a brand new checkpoint
     $st->setCheckpoint(new Story_Checkpoint($st));
     // tell the outside world what we're doing
     $activity = "Running story";
     $name = $story->getCategory() . ' > ' . $story->getGroupAsString() . ' > ' . $story->getName();
     $output->startPhaseGroup($activity, $name);
     // run the phases before the story truly starts
     $phasesPlayer->playPhases($activity, $st, $injectables, $this->startupPhases, $story);
     // what happened?
     $result = $story->getResult();
     if (!$result->getPhaseGroupSucceeded()) {
         // make sure the result has the story's filename in
         $result->filename = $this->storyFilename;
         // announce the results
         $output->endPhaseGroup($result);
         // all done
         return;
     }
     // run the phases in the 'story' section
     $phasesPlayer->playPhases($activity, $st, $injectables, $this->storyPhases, $story);
     // grab the result at this point
     $result = clone $story->getResult();
     // run the shutdown phase
     $phasesPlayer->playPhases($activity, $st, $injectables, $this->shutdownPhases, $story);
     // do we also need to look at any failures that happened during
     // the shutdown phase?
     if ($result->getPhaseGroupSucceeded()) {
         $result = $story->getResult();
     }
     // make sure the result has the story's filename in
     $result->filename = $this->storyFilename;
     // announce the results
     $output->endPhaseGroup($result);
     // all done
 }