This commit is contained in:
Adrian Nürnberger
2024-01-24 21:50:52 +01:00
parent e0f9d0bccf
commit 880b003bee

View File

@ -1,4 +1,6 @@
<?php declare(strict_types=1); <?php
declare(strict_types=1);
/* /*
* This file is part of PHPUnit. * This file is part of PHPUnit.
* *
@ -7,14 +9,9 @@
* For the full copyright and license information, please view the LICENSE * For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace PHPUnit\Logging\JUnit; namespace PHPUnit\Logging\JUnit;
use function assert;
use function basename;
use function is_int;
use function sprintf;
use function str_replace;
use function trim;
use DOMDocument; use DOMDocument;
use DOMElement; use DOMElement;
use PHPUnit\Event\Code\Test; use PHPUnit\Event\Code\Test;
@ -36,14 +33,24 @@ use PHPUnit\Event\UnknownSubscriberTypeException;
use PHPUnit\TextUI\Output\Printer; use PHPUnit\TextUI\Output\Printer;
use PHPUnit\Util\Xml; use PHPUnit\Util\Xml;
use function assert;
use function basename;
use function is_int;
use function sprintf;
use function str_replace;
use function trim;
/** /**
* @internal This class is not covered by the backward compatibility promise for PHPUnit * @internal This class is not covered by the backward compatibility promise for PHPUnit
*/ */
final class JunitXmlLogger final class JunitXmlLogger
{ {
private readonly Printer $printer; private readonly Printer $printer;
private readonly \Pest\Logging\Converter $converter; // pest-added private readonly \Pest\Logging\Converter $converter; // pest-added
private DOMDocument $document; private DOMDocument $document;
private DOMElement $root; private DOMElement $root;
/** /**
@ -80,10 +87,15 @@ final class JunitXmlLogger
* @psalm-var array<int,int> * @psalm-var array<int,int>
*/ */
private array $testSuiteTimes = [0]; private array $testSuiteTimes = [0];
private int $testSuiteLevel = 0; private int $testSuiteLevel = 0;
private ?DOMElement $currentTestCase = null; private ?DOMElement $currentTestCase = null;
private ?HRTime $time = null; private ?HRTime $time = null;
private bool $prepared = false; private bool $prepared = false;
private bool $preparationFailed = false; private bool $preparationFailed = false;
/** /**