/** * Calculates scenario header width. * * @param Scenario $scenario * @param integer $indentation * * @return integer */ public function calculateScenarioHeaderWidth(Scenario $scenario, $indentation) { $indentText = str_repeat(' ', intval($indentation)); if ($scenario instanceof ExampleNode) { $header = sprintf('%s%s', $indentText, $scenario->getTitle()); } else { $title = $scenario->getTitle(); $lines = explode("\n", $title); $header = sprintf('%s%s: %s', $indentText, $scenario->getKeyword(), array_shift($lines)); } return mb_strlen(rtrim($header), 'utf8'); }
/** * {@inheritdoc} */ public function printHeader(Formatter $formatter, FeatureNode $feature, Scenario $scenario) { if ($scenario instanceof TaggedNodeInterface) { $this->printTags($formatter->getOutputPrinter(), $scenario->getTags()); } $this->printKeyword($formatter->getOutputPrinter(), $scenario->getKeyword()); $this->printTitle($formatter->getOutputPrinter(), $scenario->getTitle()); $this->pathPrinter->printScenarioPath($formatter, $feature, $scenario, mb_strlen($this->indentText, 'utf8')); $this->printDescription($formatter->getOutputPrinter(), $scenario->getTitle()); }
/** * {@inheritDoc} */ public function printOpenTag(Formatter $formatter, FeatureNode $feature, ScenarioLikeInterface $scenario, TestResult $result) { $name = implode(' ', array_map(function ($l) { return trim($l); }, explode("\n", $scenario->getTitle()))); if ($scenario instanceof ExampleNode) { $name = $this->buildExampleName(); } /** @var JUnitOutputPrinter $outputPrinter */ $outputPrinter = $formatter->getOutputPrinter(); $outputPrinter->addTestcase(array('name' => $name, 'status' => $this->resultConverter->convertResultToString($result))); }