Skip to content

Commit 7187a93

Browse files
authored
[11.x] Test Improvements (#53586)
* [11.x] Test Improvements Correctly test Queue using `phpredis` and `predis` Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> --------- Signed-off-by: Mior Muhammad Zaki <[email protected]>
1 parent c8bd59f commit 7187a93

File tree

3 files changed

+7
-18
lines changed

3 files changed

+7
-18
lines changed

.github/workflows/queues.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,10 @@ jobs:
9494

9595
strategy:
9696
fail-fast: true
97+
matrix:
98+
client: ['phpredis', 'predis']
9799

98-
name: Redis Driver
100+
name: Redis (${{ matrix.client}}) Driver
99101

100102
steps:
101103
- name: Checkout code
@@ -122,6 +124,7 @@ jobs:
122124
- name: Execute tests
123125
run: vendor/bin/phpunit tests/Integration/Queue
124126
env:
127+
REDIS_CLIENT: ${{ matrix.client }}
125128
QUEUE_CONNECTION: redis
126129

127130
beanstalkd:

phpunit.xml.dist

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<ini name="memory_limit" value="2048M" />
1919
<env name="DB_CONNECTION" value="testing" />
2020
<!--
21+
<env name="REDIS_CLIENT" value="phpredis" />
2122
<env name="REDIS_HOST" value="127.0.0.1" />
2223
<env name="REDIS_PORT" value="6379" />
2324
-->

tests/Integration/Queue/RateLimitedWithRedisTest.php

+2-17
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,19 @@
88
use Illuminate\Cache\RateLimiting\Limit;
99
use Illuminate\Contracts\Queue\Job;
1010
use Illuminate\Contracts\Redis\Factory as Redis;
11-
use Illuminate\Foundation\Testing\Concerns\InteractsWithRedis;
1211
use Illuminate\Queue\CallQueuedHandler;
1312
use Illuminate\Queue\InteractsWithQueue;
1413
use Illuminate\Queue\Middleware\RateLimitedWithRedis;
1514
use Illuminate\Support\Str;
1615
use Mockery as m;
16+
use Orchestra\Testbench\Attributes\RequiresEnv;
1717
use Orchestra\Testbench\TestCase;
1818
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
1919

20+
#[RequiresEnv('REDIS_CLIENT')]
2021
#[RequiresPhpExtension('redis')]
2122
class RateLimitedWithRedisTest extends TestCase
2223
{
23-
use InteractsWithRedis;
24-
25-
protected function setUp(): void
26-
{
27-
parent::setUp();
28-
29-
$this->setUpRedis();
30-
}
31-
32-
protected function tearDown(): void
33-
{
34-
$this->tearDownRedis();
35-
36-
parent::tearDown();
37-
}
38-
3924
public function testUnlimitedJobsAreExecuted()
4025
{
4126
$rateLimiter = $this->app->make(RateLimiter::class);

0 commit comments

Comments
 (0)