Skip to content

Commit 74e9168

Browse files
fix: prevent EventListenersTest setup/teardown errors in CI
Added setUp() check for REDIS_AVAILABLE environment variable to skip entire test class before Laravel's HandleExceptions tries to flush state. This prevents the TypeError: PHPUnit\Runner\ErrorHandler::enable(): Argument #1 must be of type PHPUnit\Framework\TestCase, null given The error occurred in prefer-lowest CI runs where Laravel's error handler state management conflicted with PHPUnit's TestCase initialization. Now the test class is skipped entirely in non-Redis environments, preventing any setup/teardown code from running.
1 parent 44c290a commit 74e9168

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/Feature/EventListenersTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@ final class EventListenersTest extends TestCase
1818
{
1919
use RefreshDatabase;
2020

21+
protected function setUp(): void
22+
{
23+
// Skip entire test class if Redis is not available
24+
if (! getenv('REDIS_AVAILABLE')) {
25+
$this->markTestSkipped('Requires Redis - run with redis group');
26+
}
27+
28+
parent::setUp();
29+
}
30+
2131
protected function getPackageProviders($app): array
2232
{
2333
return [

0 commit comments

Comments
 (0)