-
-
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.
Add event that is emitted when a test printed output (but does not pe…
…rform assertions on it)
- Loading branch information
1 parent
f7adfb5
commit c168d82
Showing
9 changed files
with
115 additions
and
0 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
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,60 @@ | ||
<?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\Event\Test; | ||
|
||
use function sprintf; | ||
use PHPUnit\Event\Event; | ||
use PHPUnit\Event\Telemetry; | ||
|
||
/** | ||
* @psalm-immutable | ||
* | ||
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit | ||
*/ | ||
final class PrintedOutput implements Event | ||
{ | ||
private readonly Telemetry\Info $telemetryInfo; | ||
|
||
/** | ||
* @psalm-var non-empty-string | ||
*/ | ||
private readonly string $output; | ||
|
||
/** | ||
* @psalm-param non-empty-string $output | ||
*/ | ||
public function __construct(Telemetry\Info $telemetryInfo, string $output) | ||
{ | ||
$this->telemetryInfo = $telemetryInfo; | ||
$this->output = $output; | ||
} | ||
|
||
public function telemetryInfo(): Telemetry\Info | ||
{ | ||
return $this->telemetryInfo; | ||
} | ||
|
||
/** | ||
* @psalm-return non-empty-string | ||
*/ | ||
public function output(): string | ||
{ | ||
return $this->output; | ||
} | ||
|
||
public function asString(): string | ||
{ | ||
return sprintf( | ||
'Test Printed Output%s%s', | ||
PHP_EOL, | ||
$this->output | ||
); | ||
} | ||
} |
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,20 @@ | ||
<?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\Event\Test; | ||
|
||
use PHPUnit\Event\Subscriber; | ||
|
||
/** | ||
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit | ||
*/ | ||
interface PrintedOutputSubscriber extends Subscriber | ||
{ | ||
public function notify(PrintedOutput $event): void; | ||
} |
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