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%2FProgressStatisticsPrinter.php;fp=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FBehat%2FOutput%2FNode%2FPrinter%2FProgress%2FProgressStatisticsPrinter.php;h=a104178d22f1bd8eaab966e16049a3bdf82cdc3b;hp=0000000000000000000000000000000000000000;hb=1270d9129ce8f27c9b28b10518e32132c58e0aca;hpb=c27c0f0cdaa3f354b1fe54a56ae7e854be6e3f68 diff --git a/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Progress/ProgressStatisticsPrinter.php b/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Progress/ProgressStatisticsPrinter.php new file mode 100644 index 000000000..a104178d2 --- /dev/null +++ b/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Progress/ProgressStatisticsPrinter.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\CounterPrinter; +use Behat\Behat\Output\Node\Printer\ListPrinter; +use Behat\Behat\Output\Node\Printer\StatisticsPrinter; +use Behat\Behat\Output\Statistics\Statistics; +use Behat\Testwork\Output\Formatter; +use Behat\Testwork\Tester\Result\TestResult; + +/** + * Behat progress statistics printer. + * + * @author Konstantin Kudryashov + */ +final class ProgressStatisticsPrinter implements StatisticsPrinter +{ + /** + * @var CounterPrinter + */ + private $counterPrinter; + /** + * @var ListPrinter + */ + private $listPrinter; + + /** + * Initializes printer. + * + * @param CounterPrinter $counterPrinter + * @param ListPrinter $listPrinter + */ + public function __construct(CounterPrinter $counterPrinter, ListPrinter $listPrinter) + { + $this->counterPrinter = $counterPrinter; + $this->listPrinter = $listPrinter; + } + + /** + * {@inheritdoc} + */ + public function printStatistics(Formatter $formatter, Statistics $statistics) + { + $printer = $formatter->getOutputPrinter(); + + $printer->writeln(); + $printer->writeln(); + + $hookStats = $statistics->getFailedHookStats(); + $this->listPrinter->printFailedHooksList($printer, 'failed_hooks_title', $hookStats); + + $stepStats = $statistics->getFailedSteps(); + $this->listPrinter->printStepList($printer, 'failed_steps_title', TestResult::FAILED, $stepStats); + + $stepStats = $statistics->getPendingSteps(); + $this->listPrinter->printStepList($printer, 'pending_steps_title', TestResult::PENDING, $stepStats); + + $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)); + } + } +}