X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FBehat%2FOutput%2FNode%2FPrinter%2FPretty%2FPrettyOutlineTablePrinter.php;fp=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FBehat%2FOutput%2FNode%2FPrinter%2FPretty%2FPrettyOutlineTablePrinter.php;h=0000000000000000000000000000000000000000;hp=ea0298e057ccbbf82aba690c2c1aaa6ca5c705bd;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyOutlineTablePrinter.php b/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyOutlineTablePrinter.php deleted file mode 100644 index ea0298e05..000000000 --- a/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyOutlineTablePrinter.php +++ /dev/null @@ -1,145 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\Pretty; - -use Behat\Behat\Output\Node\Printer\Helper\ResultToStringConverter; -use Behat\Behat\Output\Node\Printer\OutlineTablePrinter; -use Behat\Behat\Output\Node\Printer\ScenarioPrinter; -use Behat\Behat\Output\Node\Printer\StepPrinter; -use Behat\Behat\Tester\Result\StepResult; -use Behat\Gherkin\Node\ExampleTableNode; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Printer\OutputPrinter; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Prints outline table header and footer. - * - * @author Konstantin Kudryashov - */ -final class PrettyOutlineTablePrinter implements OutlineTablePrinter -{ - /** - * @var ScenarioPrinter - */ - private $scenarioPrinter; - /** - * @var StepPrinter - */ - private $stepPrinter; - /** - * @var ResultToStringConverter - */ - private $resultConverter; - /** - * @var string - */ - private $indentText; - /** - * @var string - */ - private $subIndentText; - - /** - * Initializes printer. - * - * @param ScenarioPrinter $scenarioPrinter - * @param StepPrinter $stepPrinter - * @param ResultToStringConverter $resultConverter - * @param integer $indentation - * @param integer $subIndentation - */ - public function __construct( - ScenarioPrinter $scenarioPrinter, - StepPrinter $stepPrinter, - ResultToStringConverter $resultConverter, - $indentation = 4, - $subIndentation = 2 - ) { - $this->scenarioPrinter = $scenarioPrinter; - $this->stepPrinter = $stepPrinter; - $this->resultConverter = $resultConverter; - $this->indentText = str_repeat(' ', intval($indentation)); - $this->subIndentText = $this->indentText . str_repeat(' ', intval($subIndentation)); - } - - /** - * {@inheritdoc} - */ - public function printHeader(Formatter $formatter, FeatureNode $feature, OutlineNode $outline, array $results) - { - $this->scenarioPrinter->printHeader($formatter, $feature, $outline); - - $this->printExamplesSteps($formatter, $outline, $outline->getSteps(), $results); - $this->printExamplesTableHeader($formatter->getOutputPrinter(), $outline->getExampleTable()); - } - - /** - * {@inheritdoc} - */ - public function printFooter(Formatter $formatter, TestResult $result) - { - $formatter->getOutputPrinter()->writeln(); - } - - /** - * Prints example steps with definition paths (if has some), but without exceptions or state (skipped). - * - * @param Formatter $formatter - * @param OutlineNode $outline - * @param StepNode[] $steps - * @param StepResult[] $results - */ - private function printExamplesSteps(Formatter $formatter, OutlineNode $outline, array $steps, array $results) - { - foreach ($steps as $step) { - $result = $results[$step->getLine()]; - - $this->stepPrinter->printStep($formatter, $outline, $step, $result); - } - - $formatter->getOutputPrinter()->writeln(); - } - - /** - * Prints examples table header. - * - * @param OutputPrinter $printer - * @param ExampleTableNode $table - */ - private function printExamplesTableHeader(OutputPrinter $printer, ExampleTableNode $table) - { - $printer->writeln(sprintf('%s{+keyword}%s:{-keyword}', $this->indentText, $table->getKeyword())); - - $rowNum = 0; - $wrapper = $this->getWrapperClosure(); - $row = $table->getRowAsStringWithWrappedValues($rowNum, $wrapper); - - $printer->writeln(sprintf('%s%s', $this->subIndentText, $row)); - } - - /** - * Creates wrapper-closure for the example header. - * - * @return callable - */ - private function getWrapperClosure() - { - $style = $this->resultConverter->convertResultCodeToString(TestResult::SKIPPED); - - return function ($col) use ($style) { - return sprintf('{+%s_param}%s{-%s_param}', $style, $col, $style); - }; - } -}