Security update for permissions_by_term
[yaffs-website] / vendor / behat / behat / src / Behat / Behat / Output / Node / Printer / JUnit / JUnitSuitePrinter.php
1 <?php
2
3 /*
4  * This file is part of the Behat.
5  * (c) Konstantin Kudryashov <ever.zet@gmail.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 namespace Behat\Behat\Output\Node\Printer\JUnit;
12
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;
18
19 /**
20  * Creates new JUnit report file.
21  *
22  * @author Wouter J <wouter@wouterj.nl>
23  */
24 final class JUnitSuitePrinter implements SuitePrinter
25 {
26     /**
27      * @var PhaseStatistics
28      */
29     private $statistics;
30
31     public function __construct(PhaseStatistics $statistics = null)
32     {
33         $this->statistics = $statistics;
34     }
35
36     /**
37      * {@inheritDoc}
38      */
39     public function printHeader(Formatter $formatter, Suite $suite)
40     {
41         if ($this->statistics) {
42             $this->statistics->reset();
43         }
44
45         /** @var JUnitOutputPrinter $outputPrinter */
46         $outputPrinter = $formatter->getOutputPrinter();
47         $outputPrinter->createNewFile($suite->getName());
48     }
49
50     /**
51      * {@inheritDoc}
52      */
53     public function printFooter(Formatter $formatter, Suite $suite)
54     {
55         $formatter->getOutputPrinter()->flush();
56     }
57 }