forked from allure-framework/allure-phpunit
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extension rewritten for PHPUnit 10 (allure-framework#85)
- Loading branch information
Showing
29 changed files
with
455 additions
and
224 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
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,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Qameta\Allure\PHPUnit\Event; | ||
|
||
use PHPUnit\Event\Code\TestMethod; | ||
use PHPUnit\Event\Test\ConsideredRisky; | ||
use PHPUnit\Event\Test\ConsideredRiskySubscriber; | ||
use Qameta\Allure\Model\Status; | ||
use Qameta\Allure\PHPUnit\Internal\TestLifecycleInterface; | ||
|
||
final class TestConsideredRiskySubscriber implements ConsideredRiskySubscriber | ||
{ | ||
public function __construct( | ||
private readonly TestLifecycleInterface $testLifecycle, | ||
) { | ||
} | ||
|
||
public function notify(ConsideredRisky $event): void | ||
{ | ||
$test = $event->test(); | ||
$method = $test instanceof TestMethod ? $test->nameWithClass() : null; | ||
if (!isset($method)) { | ||
return; | ||
} | ||
|
||
$this | ||
->testLifecycle | ||
->switchTo($method) | ||
->updateStatus($event->message(), Status::failed()); | ||
} | ||
} |
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,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Qameta\Allure\PHPUnit\Event; | ||
|
||
use PHPUnit\Event\Code\TestMethod; | ||
use PHPUnit\Event\Test\Errored; | ||
use PHPUnit\Event\Test\ErroredSubscriber; | ||
use Qameta\Allure\Model\Status; | ||
use Qameta\Allure\PHPUnit\Internal\TestLifecycleInterface; | ||
|
||
final class TestErroredSubscriber implements ErroredSubscriber | ||
{ | ||
public function __construct( | ||
private readonly TestLifecycleInterface $testLifecycle, | ||
) { | ||
} | ||
|
||
public function notify(Errored $event): void | ||
{ | ||
$test = $event->test(); | ||
$method = $test instanceof TestMethod ? $test->nameWithClass() : null; | ||
if (!isset($method)) { | ||
return; | ||
} | ||
|
||
$this | ||
->testLifecycle | ||
->switchTo($method) | ||
->updateDetectedStatus($event->throwable()->message(), Status::broken()); | ||
} | ||
} |
Oops, something went wrong.