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%2FJUnit%2FJUnitFeaturePrinter.php;fp=vendor%2Fbehat%2Fbehat%2Fsrc%2FBehat%2FBehat%2FOutput%2FNode%2FPrinter%2FJUnit%2FJUnitFeaturePrinter.php;h=6b6e8718414ce0f445656f40ef4c62371242644a;hp=0000000000000000000000000000000000000000;hb=1270d9129ce8f27c9b28b10518e32132c58e0aca;hpb=c27c0f0cdaa3f354b1fe54a56ae7e854be6e3f68 diff --git a/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitFeaturePrinter.php b/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitFeaturePrinter.php new file mode 100644 index 000000000..6b6e87184 --- /dev/null +++ b/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitFeaturePrinter.php @@ -0,0 +1,70 @@ + + * + * 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\JUnit; + +use Behat\Behat\Output\Node\Printer\FeaturePrinter; +use Behat\Behat\Output\Statistics\PhaseStatistics; +use Behat\Behat\Tester\Result\StepResult; +use Behat\Gherkin\Node\FeatureNode; +use Behat\Testwork\Output\Formatter; +use Behat\Testwork\Output\Printer\JUnitOutputPrinter; +use Behat\Testwork\Tester\Result\TestResult; + +/** + * Prints the element. + * + * @author Wouter J + */ +final class JUnitFeaturePrinter implements FeaturePrinter +{ + /** + * @var PhaseStatistics + */ + private $statistics; + + public function __construct(PhaseStatistics $statistics) + { + $this->statistics = $statistics; + } + + /** + * {@inheritDoc} + */ + public function printHeader(Formatter $formatter, FeatureNode $feature) + { + $stats = $this->statistics->getScenarioStatCounts(); + + if (0 === count($stats)) { + $totalCount = 0; + } else { + $totalCount = array_sum($stats); + } + + /** @var JUnitOutputPrinter $outputPrinter */ + $outputPrinter = $formatter->getOutputPrinter(); + + $outputPrinter->addTestsuite(array( + 'name' => $feature->getTitle(), + 'tests' => $totalCount, + 'skipped' => $stats[TestResult::SKIPPED], + 'failures' => $stats[TestResult::FAILED], + 'errors' => $stats[TestResult::PENDING] + $stats[StepResult::UNDEFINED], + )); + $this->statistics->reset(); + } + + /** + * {@inheritDoc} + */ + public function printFooter(Formatter $formatter, TestResult $result) + { + } +}