Skip to content

Commit aae2542

Browse files
Do not swallow exceptions in event subscribers when PHPUnit's own test suite is running
1 parent b8f8106 commit aae2542

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Event/Dispatcher/DirectDispatcher.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use const PHP_EOL;
1313
use function array_key_exists;
14+
use function defined;
1415
use function dirname;
1516
use function sprintf;
1617
use function str_starts_with;
@@ -114,7 +115,8 @@ public function dispatch(Event $event): void
114115
*/
115116
public function handleThrowable(Throwable $t): void
116117
{
117-
if ($this->isThrowableFromThirdPartySubscriber($t)) {
118+
if (!defined('PHPUNIT_TESTSUITE') &&
119+
$this->isThrowableFromThirdPartySubscriber($t)) {
118120
Facade::emitter()->testRunnerTriggeredWarning(
119121
sprintf(
120122
'Exception in third-party event subscriber: %s%s%s',

0 commit comments

Comments
 (0)