4 * This file is part of the Behat.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 namespace Behat\Behat\Output\Node\Printer\JUnit;
13 use Behat\Behat\Output\Node\Printer\SuitePrinter;
14 use Behat\Behat\Output\Statistics\PhaseStatistics;
15 use Behat\Testwork\Output\Formatter;
16 use Behat\Testwork\Output\Printer\JUnitOutputPrinter;
17 use Behat\Testwork\Suite\Suite;
20 * Creates new JUnit report file.
22 * @author Wouter J <wouter@wouterj.nl>
24 final class JUnitSuitePrinter implements SuitePrinter
27 * @var PhaseStatistics
31 public function __construct(PhaseStatistics $statistics = null)
33 $this->statistics = $statistics;
39 public function printHeader(Formatter $formatter, Suite $suite)
41 if ($this->statistics) {
42 $this->statistics->reset();
45 /** @var JUnitOutputPrinter $outputPrinter */
46 $outputPrinter = $formatter->getOutputPrinter();
47 $outputPrinter->createNewFile($suite->getName());
53 public function printFooter(Formatter $formatter, Suite $suite)
55 $formatter->getOutputPrinter()->flush();