diff --git a/src/Generator/Node/DummyFeatureNode.php b/src/Generator/Node/DummyFeatureNode.php index 0a618e6..cbb4b43 100644 --- a/src/Generator/Node/DummyFeatureNode.php +++ b/src/Generator/Node/DummyFeatureNode.php @@ -14,9 +14,9 @@ class DummyFeatureNode private $featureNode; /** - * @var StepNode + * @var StepNode[] */ - private $stepNode; + private $stepNodes; /** * @param FeatureNode $featureNode @@ -24,7 +24,7 @@ class DummyFeatureNode public function __construct(FeatureNode $featureNode) { $this->featureNode = $featureNode; - $this->findStepNode(); + $this->findStepNodes(); } /** @@ -36,28 +36,28 @@ public function getFeatureNode() } /** - * @return StepNode + * @return StepNode[] */ - public function getStepNode() + public function getStepNodes() { - return $this->stepNode; + return $this->stepNodes; } - - private function findStepNode() + + private function findStepNodes() { $scenarios = $this->featureNode->getScenarios(); if (count($scenarios) === 0) { throw new \InvalidArgumentException('Unable to find any scenarios in dummy feature'); } - + $scenario = $scenarios[0]; $steps = $scenario->getSteps(); - + if (count($steps) === 0) { throw new \InvalidArgumentException('Unable to find any steps in dummy feature'); } - - $this->stepNode = $steps[0]; + + $this->stepNodes = $steps; } - -} \ No newline at end of file + +} diff --git a/src/Runner/StepRunner.php b/src/Runner/StepRunner.php index d9b22c3..b85f548 100644 --- a/src/Runner/StepRunner.php +++ b/src/Runner/StepRunner.php @@ -50,13 +50,13 @@ public function run($steps, Suite $suite) $env = $this->environmentManager->isolateEnvironment($env); $dummyFeatureNode = $this->generator->generate($steps); - $featureNode = $dummyFeatureNode->getFeatureNode(); - $stepNode = $dummyFeatureNode->getStepNode(); - $this->stepTester->setUp($env, $featureNode, $stepNode, false); - $result = $this->stepTester->test($env, $featureNode, $stepNode, false); - $this->stepTester->tearDown($env, $featureNode, $stepNode, false, $result); + foreach ($dummyFeatureNode->getStepNodes() as $stepNode) { + $this->stepTester->setUp($env, $featureNode, $stepNode, false); + $result = $this->stepTester->test($env, $featureNode, $stepNode, false); + $this->stepTester->tearDown($env, $featureNode, $stepNode, false, $result); + } return $result; }