Skip to content

Commit 4d552d4

Browse files
fix(tests): EventListenersTest must extend package TestCase
EventListenersTest was extending Orchestra\Testbench\TestCase directly instead of our PHPeek\LaravelQueueMetrics\Tests\TestCase. This caused: 1. Tests to bypass our getEnvironmentSetUp() that disables metrics 2. defineEnvironment() to enable metrics without Redis check 3. Tests to attempt Redis connection even without REDIS_AVAILABLE 4. Connection refused errors when running without Redis service Changes: - Use PHPeek\LaravelQueueMetrics\Tests\TestCase as base class - Call parent::defineEnvironment() to inherit config disabling - Remove duplicate getPackageProviders() (inherited from base) - Tests now properly skip when REDIS_AVAILABLE env var not set Result: - 124 tests pass with --exclude-group=redis,arch (was 118) - No Redis connection errors when running without Redis - EventListenersTest properly skips all 3 tests without Redis
1 parent b54f6c3 commit 4d552d4

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

tests/Feature/EventListenersTest.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66

77
use Illuminate\Foundation\Testing\RefreshDatabase;
88
use Illuminate\Support\Facades\Queue;
9-
use Orchestra\Testbench\TestCase;
10-
use PHPeek\LaravelQueueMetrics\LaravelQueueMetricsServiceProvider;
119
use PHPeek\LaravelQueueMetrics\Repositories\Contracts\JobMetricsRepository;
1210
use PHPeek\LaravelQueueMetrics\Tests\Feature\Support\TestJob;
11+
use PHPeek\LaravelQueueMetrics\Tests\TestCase;
1312

1413
/**
1514
* @group redis
@@ -28,15 +27,10 @@ protected function setUp(): void
2827
parent::setUp();
2928
}
3029

31-
protected function getPackageProviders($app): array
32-
{
33-
return [
34-
LaravelQueueMetricsServiceProvider::class,
35-
];
36-
}
37-
3830
protected function defineEnvironment($app): void
3931
{
32+
parent::defineEnvironment($app);
33+
4034
$app['config']->set('queue.default', 'sync');
4135
$app['config']->set('queue-metrics.enabled', true);
4236
$app['config']->set('queue-metrics.storage.driver', 'redis');

0 commit comments

Comments
 (0)