-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhancement: Update extension to use event system of phpunit/phpunit:…
…10.0.0
- Loading branch information
1 parent
a05623c
commit 00e07ed
Showing
11 changed files
with
221 additions
and
130 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,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace JohnKary\PHPUnit\Extension; | ||
|
||
use PHPUnit\Event; | ||
|
||
final class PreparedTest | ||
{ | ||
public function __construct( | ||
private readonly Event\Code\Test $test, | ||
private readonly Event\Telemetry\HRTime $start | ||
) { | ||
} | ||
|
||
public function test(): Event\Code\Test | ||
{ | ||
return $this->test; | ||
} | ||
|
||
public function start(): Event\Telemetry\HRTime | ||
{ | ||
return $this->start; | ||
} | ||
} |
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,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace JohnKary\PHPUnit\Extension; | ||
|
||
use PHPUnit\Event; | ||
|
||
final class RecordThatTestHasBeenPrepared implements Event\Test\PreparedSubscriber | ||
{ | ||
public function __construct(private readonly SpeedTrap $speedTrap) | ||
{ | ||
} | ||
|
||
public function notify(Event\Test\Prepared $event): void | ||
{ | ||
$this->speedTrap->recordThatTestHasBeenPrepared( | ||
$event->test(), | ||
$event->telemetryInfo()->time(), | ||
); | ||
} | ||
} |
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,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace JohnKary\PHPUnit\Extension; | ||
|
||
use PHPUnit\Event; | ||
|
||
final class RecordThatTestHasPassed implements Event\Test\PassedSubscriber | ||
{ | ||
public function __construct(private readonly SpeedTrap $speedTrap) | ||
{ | ||
} | ||
|
||
public function notify(Event\Test\Passed $event): void | ||
{ | ||
$this->speedTrap->recordThatTestHasPassed( | ||
$event->test(), | ||
$event->telemetryInfo()->time(), | ||
); | ||
} | ||
} |
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,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace JohnKary\PHPUnit\Extension; | ||
|
||
use PHPUnit\Event; | ||
|
||
final class ShowSlowTests implements Event\TestRunner\ExecutionFinishedSubscriber | ||
{ | ||
public function __construct(private readonly SpeedTrap $speedTrap) | ||
{ | ||
} | ||
|
||
public function notify(Event\TestRunner\ExecutionFinished $event): void | ||
{ | ||
$this->speedTrap->showSlowTests(); | ||
} | ||
} |
Oops, something went wrong.