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%2FProgress%2FProgressStepPrinter.php;fp=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FBehat%2FOutput%2FNode%2FPrinter%2FProgress%2FProgressStepPrinter.php;h=ca1656f9aab49ab98fd67ff721040e1d3e2925cd;hp=0000000000000000000000000000000000000000;hb=1270d9129ce8f27c9b28b10518e32132c58e0aca;hpb=c27c0f0cdaa3f354b1fe54a56ae7e854be6e3f68 diff --git a/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Progress/ProgressStepPrinter.php b/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Progress/ProgressStepPrinter.php new file mode 100644 index 000000000..ca1656f9a --- /dev/null +++ b/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Progress/ProgressStepPrinter.php @@ -0,0 +1,77 @@ + + * + * 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\Progress; + +use Behat\Behat\Output\Node\Printer\Helper\ResultToStringConverter; +use Behat\Behat\Output\Node\Printer\StepPrinter; +use Behat\Behat\Tester\Result\StepResult; +use Behat\Gherkin\Node\ScenarioLikeInterface as Scenario; +use Behat\Gherkin\Node\StepNode; +use Behat\Testwork\Output\Formatter; +use Behat\Testwork\Tester\Result\TestResult; + +/** + * Behat progress step printer. + * + * @author Konstantin Kudryashov + */ +final class ProgressStepPrinter implements StepPrinter +{ + /** + * @var ResultToStringConverter + */ + private $resultConverter; + /** + * @var integer + */ + private $stepsPrinted = 0; + + /** + * Initializes printer. + * + * @param ResultToStringConverter $resultConverter + */ + public function __construct(ResultToStringConverter $resultConverter) + { + $this->resultConverter = $resultConverter; + } + + /** + * {@inheritdoc} + */ + public function printStep(Formatter $formatter, Scenario $scenario, StepNode $step, StepResult $result) + { + $printer = $formatter->getOutputPrinter(); + $style = $this->resultConverter->convertResultToString($result); + + switch ($result->getResultCode()) { + case TestResult::PASSED: + $printer->write("{+$style}.{-$style}"); + break; + case TestResult::SKIPPED: + $printer->write("{+$style}-{-$style}"); + break; + case TestResult::PENDING: + $printer->write("{+$style}P{-$style}"); + break; + case StepResult::UNDEFINED: + $printer->write("{+$style}U{-$style}"); + break; + case TestResult::FAILED: + $printer->write("{+$style}F{-$style}"); + break; + } + + if (++$this->stepsPrinted % 70 == 0) { + $printer->writeln(' ' . $this->stepsPrinted); + } + } +}