/** * @return Step */ public function add(Scenario $scenario) { if (!($step = $scenario->getRoot())) { throw new LogicException('Unable to add an empty scenario.'); } $options = $this->root->getOptions(); $this->root = clone $scenario->getRoot(); $this->root->setOptions($options); return $this->root; }
public function add(Scenario $scenario) { if (!($step = $scenario->getRoot())) { throw new LogicException('Unable to add an empty scenario.'); } if ($this->root) { throw new LogicException('Unable to add a scenario at the root step.'); } $this->next = clone $scenario->getRoot(); $this->next->root = false; $this->next->options = $this->options; return $this->next->getLast(); }