Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 15 |
CRAP | |
0.00% |
0 / 66 |
Scenario | |
0.00% |
0 / 1 |
|
0.00% |
0 / 15 |
342 | |
0.00% |
0 / 66 |
__construct(\Codeception\TestCase $test) | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
|||
setFeature($feature) | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
condition($action, $arguments) | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
|||
action($action, $arguments) | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
|||
assertion($action, $arguments) | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
|||
runStep() | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 11 |
|||
lastStep() | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
|||
addStep(\Codeception\Step $step) | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 5 |
|||
getSteps() | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 5 |
|||
getFeature() | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
comment($comment) | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
|||
getCurrentStep() | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
|||
run() | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 5 |
|||
running() | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
|||
preload() | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 3 |
<?php | |
namespace Codeception; | |
class Scenario { | |
/** | |
* @var \Codeception\TestCase | |
*/ | |
protected $test; | |
/** | |
* @var array | |
*/ | |
protected $steps = array(); | |
/** | |
* @var string | |
*/ | |
protected $feature; | |
protected $currentStep = 0; | |
protected $finalizers = array(); | |
protected $running = false; | |
protected $preloadedSteps = array(); | |
/** | |
* Constructor. | |
* | |
* @param \Codeception\TestCase $test | |
*/ | |
public function __construct(\Codeception\TestCase $test) | |
{ | |
$this->test = $test; | |
} | |
public function setFeature($feature) { | |
$this->feature = $feature; | |
} | |
public function condition($action, $arguments) | |
{ | |
return $this->addStep(new \Codeception\Step\Condition($action, $arguments)); | |
} | |
public function action($action, $arguments) | |
{ | |
return $this->addStep(new \Codeception\Step\Action($action, $arguments)); | |
} | |
public function assertion($action, $arguments) | |
{ | |
return $this->addStep(new \Codeception\Step\Assertion($action, $arguments)); | |
} | |
public function runStep() | |
{ | |
if (empty($this->steps)) return; | |
$step = $this->lastStep(); | |
if (!$step->executed) { | |
$result = $this->test->runStep($step); | |
$this->currentStep++; | |
$step->executed = true; | |
return $result; | |
} | |
} | |
/** | |
* @return \Codeception\Step | |
*/ | |
protected function lastStep() | |
{ | |
return end($this->steps); | |
} | |
protected function addStep(\Codeception\Step $step) | |
{ | |
$this->steps[] = $step; | |
return $this->test; | |
} | |
/** | |
* Returns the steps of this scenario. | |
* | |
* @return array | |
*/ | |
public function getSteps() | |
{ | |
if (!$this->running) return $this->steps; | |
return $this->preloadedSteps; | |
} | |
public function getFeature() { | |
return $this->feature; | |
} | |
public function comment($comment) { | |
$this->addStep(new \Codeception\Step\Comment($comment,array())); | |
} | |
public function getCurrentStep() | |
{ | |
return $this->currentStep; | |
} | |
public function run() { | |
$this->running = true; | |
$this->preloadedSteps = $this->steps; | |
$this->steps = array(); | |
} | |
public function running() | |
{ | |
return $this->running; | |
} | |
public function preload() { | |
return !$this->running; | |
} | |
} |