Skip to content

Commit

Permalink
fix(testing): Requirements extension will not listen `BeforeFirstTest…
Browse files Browse the repository at this point in the history
…MethodCalled` because it may confuse PHPStorm.
  • Loading branch information
LastDragon-ru committed Jan 21, 2024
1 parent 1809643 commit 8140128
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
4 changes: 0 additions & 4 deletions packages/testing/src/Requirements/PhpUnit/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use LastDragon_ru\LaraASP\Testing\Requirements\Requirement;
use Override;
use PHPUnit\Event\Test\BeforeFirstTestMethodCalledSubscriber;
use PHPUnit\Event\Test\BeforeTestMethodCalledSubscriber;
use PHPUnit\Event\Test\PreConditionCalledSubscriber;
use PHPUnit\Event\Test\PreparedSubscriber;
Expand All @@ -28,9 +27,6 @@ public function bootstrap(Configuration $configuration, Facade $facade, Paramete
$checker = new Checker();

$facade->registerSubscribers(
new class ($checker) extends Listener implements BeforeFirstTestMethodCalledSubscriber {
// empty
},
new class ($checker) extends Listener implements BeforeTestMethodCalledSubscriber {
// empty
},
Expand Down
7 changes: 1 addition & 6 deletions packages/testing/src/Requirements/PhpUnit/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use PHPUnit\Event\Code\TestMethod;
use PHPUnit\Event\Event;
use PHPUnit\Event\Test\BeforeFirstTestMethodCalled;
use PHPUnit\Event\Test\BeforeTestMethodCalled;
use PHPUnit\Event\Test\PreConditionCalled;
use PHPUnit\Event\Test\Prepared;
Expand Down Expand Up @@ -48,11 +47,7 @@ protected function getTarget(Event $event): array {
$class = null;
$method = null;

if (
$event instanceof BeforeFirstTestMethodCalled
|| $event instanceof BeforeTestMethodCalled
|| $event instanceof PreConditionCalled
) {
if ($event instanceof BeforeTestMethodCalled || $event instanceof PreConditionCalled) {
$class = $event->testClassName();
} elseif ($event instanceof Prepared) {
$test = $event->test();
Expand Down

0 comments on commit 8140128

Please sign in to comment.