/**
  * {@inheritdoc}
  */
 public function listenEvent(Formatter $formatter, Event $event, $eventName)
 {
     if ($this->value !== $formatter->getParameter($this->name)) {
         return;
     }
     $this->descendant->listenEvent($formatter, $event, $eventName);
 }
示例#2
0
 /**
  * Prints step path comment.
  *
  * @param Formatter  $formatter
  * @param Scenario   $scenario
  * @param StepNode   $step
  * @param StepResult $result
  * @param integer    $indentation
  */
 public function printStepPath(Formatter $formatter, Scenario $scenario, StepNode $step, StepResult $result, $indentation)
 {
     $printer = $formatter->getOutputPrinter();
     if (!$result instanceof DefinedStepResult || !$result->getStepDefinition() || !$formatter->getParameter('paths')) {
         $printer->writeln();
         return;
     }
     $textWidth = $this->widthCalculator->calculateStepWidth($step, $indentation);
     $scenarioWidth = $this->widthCalculator->calculateScenarioWidth($scenario, $indentation - 2, 2);
     $this->printDefinedStepPath($printer, $result, $scenarioWidth, $textWidth);
 }
 /**
  * {@inheritdoc}
  */
 public function printStatistics(Formatter $formatter, Statistics $statistics)
 {
     $printer = $formatter->getOutputPrinter();
     $scenarioStats = $statistics->getSkippedScenarios();
     $this->listPrinter->printScenariosList($printer, 'skipped_scenarios_title', TestResult::SKIPPED, $scenarioStats);
     $scenarioStats = $statistics->getFailedScenarios();
     $this->listPrinter->printScenariosList($printer, 'failed_scenarios_title', TestResult::FAILED, $scenarioStats);
     $this->counterPrinter->printCounters($printer, 'scenarios_count', $statistics->getScenarioStatCounts());
     $this->counterPrinter->printCounters($printer, 'steps_count', $statistics->getStepStatCounts());
     if ($formatter->getParameter('timer')) {
         $timer = $statistics->getTimer();
         $memory = $statistics->getMemory();
         $formatter->getOutputPrinter()->writeln(sprintf('%s (%s)', $timer, $memory));
     }
 }
 /**
  * Prints step multiline arguments.
  *
  * @param Formatter           $formatter
  * @param ArgumentInterface[] $arguments
  */
 private function printArguments(Formatter $formatter, array $arguments)
 {
     $style = $this->resultConverter->convertResultCodeToString(TestResult::SKIPPED);
     foreach ($arguments as $argument) {
         $text = $this->getArgumentString($argument, !$formatter->getParameter('multiline'));
         $indentedText = implode("\n", array_map(array($this, 'subIndent'), explode("\n", $text)));
         $formatter->getOutputPrinter()->writeln(sprintf('{+%s}%s{-%s}', $style, $indentedText, $style));
     }
 }