Skip to content

Commit

Permalink
Hook on finished instead of passed test event
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Nov 28, 2023
1 parent 4d7bf11 commit 3fc2545
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion composer-require-checker.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"symbol-whitelist": [
"PHPUnit\\Runner\\AfterLastTestHook",
"PHPUnit\\Runner\\AfterSuccessfulTestHook",
"PHPUnit\\Runner\\AfterTestHook",
"PHPUnit\\Runner\\BeforeFirstTestHook"
]
}
4 changes: 2 additions & 2 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<code>($durationInMilliseconds - $hoursInMilliseconds - $minutesInMilliseconds) / 1_000</code>
</InvalidOperand>
</file>
<file src="src/Subscriber/TestPassedSubscriber.php">
<file src="src/Subscriber/TestFinishedSubscriber.php">
<InternalClass>
<code>Metadata\Annotation\Parser\Registry::getInstance()</code>
</InternalClass>
Expand All @@ -34,7 +34,7 @@
<code>$maximumDuration</code>
</MixedAssignment>
<UnusedClass>
<code>TestPassedSubscriber</code>
<code>TestFinishedSubscriber</code>
</UnusedClass>
</file>
<file src="src/Subscriber/TestPreparedSubscriber.php">
Expand Down
6 changes: 3 additions & 3 deletions src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function bootstrap(

$facade->registerSubscribers(
new Subscriber\TestPreparedSubscriber($timeKeeper),
new Subscriber\TestPassedSubscriber(
new Subscriber\TestFinishedSubscriber(

Check warning on line 66 in src/Extension.php

View check run for this annotation

Codecov / codecov/patch

src/Extension.php#L66

Added line #L66 was not covered by tests
$maximumDuration,
$timeKeeper,
$collector,
Expand All @@ -81,7 +81,7 @@ public function bootstrap(
*/
final class Extension implements
Runner\AfterLastTestHook,
Runner\AfterSuccessfulTestHook,
Runner\AfterTestHook,
Runner\BeforeFirstTestHook
{
private int $suites = 0;
Expand Down Expand Up @@ -117,7 +117,7 @@ public function executeBeforeFirstTest(): void
++$this->suites;
}

public function executeAfterSuccessfulTest(
public function executeAfterTest(

Check warning on line 120 in src/Extension.php

View check run for this annotation

Codecov / codecov/patch

src/Extension.php#L120

Added line #L120 was not covered by tests
string $test,
float $time,
): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/**
* @internal
*/
final class TestPassedSubscriber implements Event\Test\PassedSubscriber
final class TestFinishedSubscriber implements Event\Test\FinishedSubscriber
{
public function __construct(
private readonly Duration $maximumDuration,
Expand All @@ -35,7 +35,7 @@ public function __construct(
) {
}

public function notify(Event\Test\Passed $event): void
public function notify(Event\Test\Finished $event): void

Check warning on line 38 in src/Subscriber/TestFinishedSubscriber.php

View check run for this annotation

Codecov / codecov/patch

src/Subscriber/TestFinishedSubscriber.php#L38

Added line #L38 was not covered by tests
{
$testIdentifier = TestIdentifier::fromString($event->test()->id());

Expand Down

0 comments on commit 3fc2545

Please sign in to comment.