-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a58a6a2
commit 28704cf
Showing
21 changed files
with
298 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of PHPUnit. | ||
* | ||
* (c) Sebastian Bergmann <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace PHPUnit\Logging\Xml; | ||
|
||
/** | ||
* @internal This class is not covered by the backward compatibility promise for PHPUnit | ||
*/ | ||
abstract class Subscriber | ||
{ | ||
private readonly XmlLogger $logger; | ||
|
||
public function __construct(XmlLogger $logger) | ||
{ | ||
$this->logger = $logger; | ||
} | ||
|
||
protected function logger(): XmlLogger | ||
{ | ||
return $this->logger; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/Logging/Xml/Subscriber/TestRunnerExecutionFinishedSubscriber.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of PHPUnit. | ||
* | ||
* (c) Sebastian Bergmann <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace PHPUnit\Logging\Xml; | ||
|
||
use PHPUnit\Event\TestRunner\ExecutionFinished; | ||
use PHPUnit\Event\TestRunner\ExecutionFinishedSubscriber; | ||
|
||
/** | ||
* @internal This class is not covered by the backward compatibility promise for PHPUnit | ||
*/ | ||
final class TestRunnerExecutionFinishedSubscriber extends Subscriber implements ExecutionFinishedSubscriber | ||
{ | ||
public function notify(ExecutionFinished $event): void | ||
{ | ||
$this->logger()->flush(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php declare(strict_types=1); | ||
/* | ||
* This file is part of PHPUnit. | ||
* | ||
* (c) Sebastian Bergmann <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace PHPUnit\Logging\Xml; | ||
|
||
use PHPUnit\Event\EventFacadeIsSealedException; | ||
use PHPUnit\Event\Facade; | ||
use PHPUnit\Event\UnknownSubscriberTypeException; | ||
use PHPUnit\TextUI\Output\Printer; | ||
|
||
/** | ||
* @internal This class is not covered by the backward compatibility promise for PHPUnit | ||
*/ | ||
final class XmlLogger | ||
{ | ||
private readonly Printer $printer; | ||
|
||
/** | ||
* @throws EventFacadeIsSealedException | ||
* @throws UnknownSubscriberTypeException | ||
*/ | ||
public function __construct(Printer $printer, Facade $facade) | ||
{ | ||
$this->printer = $printer; | ||
|
||
$this->registerSubscribers($facade); | ||
} | ||
|
||
public function flush(): void | ||
{ | ||
$this->printer->print('todo'); | ||
|
||
$this->printer->flush(); | ||
} | ||
|
||
/** | ||
* @throws EventFacadeIsSealedException | ||
* @throws UnknownSubscriberTypeException | ||
*/ | ||
private function registerSubscribers(Facade $facade): void | ||
{ | ||
$facade->registerSubscribers( | ||
new TestRunnerExecutionFinishedSubscriber($this), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.