/** * {@inheritdoc} */ protected function printFeatureName(FeatureNode $feature) { $this->writeln('<h2>'); $this->writeln('<span class="keyword">' . $feature->getKeyword() . ': </span>'); $this->writeln('<span class="title">' . $feature->getTitle() . '</span>'); $this->writeln('</h2>'); }
/** * Prints feature title using provided printer. * * @param OutputPrinter $printer * @param FeatureNode $feature */ private function printTitle(OutputPrinter $printer, FeatureNode $feature) { $printer->write(sprintf('%s{+keyword}%s:{-keyword}', $this->indentText, $feature->getKeyword())); if ($title = $feature->getTitle()) { $printer->write(sprintf(' %s', $title)); } $printer->writeln(); }
/** * @param FeatureNode $feature * * @return string */ public function format(FeatureNode $feature) { $shortDesc = $feature->getKeyword() . ': ' . $feature->getTitle() . "\n"; if (!$feature->hasDescription()) { return rtrim($shortDesc); } $longDesc = implode(array_map(function ($descriptionLine) { return $this->indent() . trim($descriptionLine) . "\n"; }, explode("\n", $feature->getDescription()))); return $shortDesc . rtrim($longDesc); }
/** * Filters feature according to the filter. * * @param FeatureNode $feature * * @return FeatureNode */ public function filterFeature(FeatureNode $feature) { $scenarios = array(); foreach ($feature->getScenarios() as $scenario) { if (!$this->isScenarioMatch($scenario)) { continue; } if ($scenario instanceof OutlineNode && $scenario->hasExamples()) { $table = $scenario->getExampleTable()->getTable(); $lines = array_keys($table); $filteredTable = array($lines[0] => $table[$lines[0]]); unset($table[$lines[0]]); foreach ($table as $line => $row) { if ($this->filterMinLine <= $line && $this->filterMaxLine >= $line) { $filteredTable[$line] = $row; } } $scenario = new OutlineNode($scenario->getTitle(), $scenario->getTags(), $scenario->getSteps(), new ExampleTableNode($filteredTable, $scenario->getExampleTable()->getKeyword()), $scenario->getKeyword(), $scenario->getLine()); } $scenarios[] = $scenario; } return new FeatureNode($feature->getTitle(), $feature->getDescription(), $feature->getTags(), $feature->getBackground(), $scenarios, $feature->getKeyword(), $feature->getLanguage(), $feature->getFile(), $feature->getLine()); }