Skip to content

[11.x] Test Improvements #53586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[11.x] Test Improvements
Correctly test Queue using `phpredis` and `predis`

Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Nov 20, 2024
commit 1d3db3d0c975f444811092cd5387ab7a733d4395
5 changes: 4 additions & 1 deletion .github/workflows/queues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ jobs:

strategy:
fail-fast: true
matrix:
client: ['phpredis', 'predis']

name: Redis Driver
name: Redis (${{ matrix.client}}) Driver

steps:
- name: Checkout code
Expand All @@ -122,6 +124,7 @@ jobs:
- name: Execute tests
run: vendor/bin/phpunit tests/Integration/Queue
env:
REDIS_CLIENT: ${{ matrix.client }}
QUEUE_CONNECTION: redis

beanstalkd:
Expand Down
19 changes: 2 additions & 17 deletions tests/Integration/Queue/RateLimitedWithRedisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,19 @@
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Contracts\Queue\Job;
use Illuminate\Contracts\Redis\Factory as Redis;
use Illuminate\Foundation\Testing\Concerns\InteractsWithRedis;
use Illuminate\Queue\CallQueuedHandler;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\Middleware\RateLimitedWithRedis;
use Illuminate\Support\Str;
use Mockery as m;
use Orchestra\Testbench\Attributes\RequiresEnv;
use Orchestra\Testbench\TestCase;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;

#[RequiresEnv('REDIS_CLIENT')]
#[RequiresPhpExtension('redis')]
class RateLimitedWithRedisTest extends TestCase
{
use InteractsWithRedis;

protected function setUp(): void
{
parent::setUp();

$this->setUpRedis();
}

protected function tearDown(): void
{
$this->tearDownRedis();

parent::tearDown();
}

public function testUnlimitedJobsAreExecuted()
{
$rateLimiter = $this->app->make(RateLimiter::class);
Expand Down