Skip to content

Commit bc6c54d

Browse files
author
David Běhal
committed
Rename config due laravel 12.34 collision
1 parent 190c450 commit bc6c54d

File tree

9 files changed

+113
-84
lines changed

9 files changed

+113
-84
lines changed

.docker/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM php:8.2-cli
2+
3+
# Install system dependencies
4+
RUN apt-get update && apt-get install -y \
5+
git \
6+
zip \
7+
unzip \
8+
&& rm -rf /var/lib/apt/lists/*
9+
10+
# Install PHP extensions
11+
RUN docker-php-ext-install sockets pcntl
12+
13+
# Install Composer
14+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
15+
16+
WORKDIR /app

docker-compose.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3.7'
2-
31
services:
42

53
rabbitmq:
@@ -41,3 +39,18 @@ services:
4139
- 15672:15672
4240
- 5671:5671
4341
- 5672:5672
42+
43+
php:
44+
build:
45+
context: .
46+
dockerfile: .docker/Dockerfile
47+
environment:
48+
HOST: rabbitmq
49+
PORT: 5672
50+
volumes:
51+
- .:/app
52+
working_dir: /app
53+
tty: true
54+
stdin_open: true
55+
depends_on:
56+
- rabbitmq

src/Queue/RabbitMQQueue.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ class RabbitMQQueue extends Queue implements QueueContract, RabbitMQQueueContrac
6262
/**
6363
* Holds the Configuration
6464
*/
65-
protected QueueConfig $config;
65+
protected QueueConfig $rabbitMQConfig;
6666

6767
/**
6868
* RabbitMQQueue constructor.
6969
*/
7070
public function __construct(QueueConfig $config)
7171
{
72-
$this->config = $config;
72+
$this->rabbitMQConfig = $config;
7373
$this->dispatchAfterCommit = $config->isDispatchAfterCommit();
7474
}
7575

@@ -293,7 +293,7 @@ public function setConnection(AbstractConnection $connection): RabbitMQQueue
293293
*/
294294
public function getJobClass(): string
295295
{
296-
$job = $this->getConfig()->getAbstractJob();
296+
$job = $this->getRabbitMQConfig()->getAbstractJob();
297297

298298
throw_if(
299299
! is_a($job, RabbitMQJob::class, true),
@@ -309,7 +309,7 @@ public function getJobClass(): string
309309
*/
310310
public function getQueue($queue = null): string
311311
{
312-
return $queue ?: $this->getConfig()->getQueue();
312+
return $queue ?: $this->getRabbitMQConfig()->getQueue();
313313
}
314314

315315
/**
@@ -523,7 +523,7 @@ protected function createMessage($payload, int $attempts = 0): array
523523
$properties['correlation_id'] = $correlationId;
524524
}
525525

526-
if ($this->getConfig()->isPrioritizeDelayed()) {
526+
if ($this->getRabbitMQConfig()->isPrioritizeDelayed()) {
527527
$properties['priority'] = $attempts;
528528
}
529529

@@ -605,16 +605,16 @@ protected function getQueueArguments(string $destination): array
605605
// Messages with a priority which is higher than the queue's maximum, are treated as if they were
606606
// published with the maximum priority.
607607
// Quorum queues does not support priority.
608-
if ($this->getConfig()->isPrioritizeDelayed() && ! $this->getConfig()->isQuorum()) {
609-
$arguments['x-max-priority'] = $this->getConfig()->getQueueMaxPriority();
608+
if ($this->getRabbitMQConfig()->isPrioritizeDelayed() && ! $this->getRabbitMQConfig()->isQuorum()) {
609+
$arguments['x-max-priority'] = $this->getRabbitMQConfig()->getQueueMaxPriority();
610610
}
611611

612-
if ($this->getConfig()->isRerouteFailed()) {
612+
if ($this->getRabbitMQConfig()->isRerouteFailed()) {
613613
$arguments['x-dead-letter-exchange'] = $this->getFailedExchange();
614614
$arguments['x-dead-letter-routing-key'] = $this->getFailedRoutingKey($destination);
615615
}
616616

617-
if ($this->getConfig()->isQuorum()) {
617+
if ($this->getRabbitMQConfig()->isQuorum()) {
618618
$arguments['x-queue-type'] = 'quorum';
619619
}
620620

@@ -639,7 +639,7 @@ protected function getDelayQueueArguments(string $destination, int $ttl): array
639639
*/
640640
protected function getExchange(?string $exchange = null): string
641641
{
642-
return $exchange ?? $this->getConfig()->getExchange();
642+
return $exchange ?? $this->getRabbitMQConfig()->getExchange();
643643
}
644644

645645
/**
@@ -648,15 +648,15 @@ protected function getExchange(?string $exchange = null): string
648648
*/
649649
protected function getRoutingKey(string $destination): string
650650
{
651-
return ltrim(sprintf($this->getConfig()->getExchangeRoutingKey(), $destination), '.');
651+
return ltrim(sprintf($this->getRabbitMQConfig()->getExchangeRoutingKey(), $destination), '.');
652652
}
653653

654654
/**
655655
* Get the exchangeType, or AMQPExchangeType::DIRECT as default.
656656
*/
657657
protected function getExchangeType(?string $type = null): string
658658
{
659-
$constant = AMQPExchangeType::class.'::'.Str::upper($type ?: $this->getConfig()->getExchangeType());
659+
$constant = AMQPExchangeType::class.'::'.Str::upper($type ?: $this->getRabbitMQConfig()->getExchangeType());
660660

661661
return defined($constant) ? constant($constant) : AMQPExchangeType::DIRECT;
662662
}
@@ -666,7 +666,7 @@ protected function getExchangeType(?string $type = null): string
666666
*/
667667
protected function getFailedExchange(?string $exchange = null): string
668668
{
669-
return $exchange ?? $this->getConfig()->getFailedExchange();
669+
return $exchange ?? $this->getRabbitMQConfig()->getFailedExchange();
670670
}
671671

672672
/**
@@ -675,7 +675,7 @@ protected function getFailedExchange(?string $exchange = null): string
675675
*/
676676
protected function getFailedRoutingKey(string $destination): string
677677
{
678-
return ltrim(sprintf($this->getConfig()->getFailedRoutingKey(), $destination), '.');
678+
return ltrim(sprintf($this->getRabbitMQConfig()->getFailedRoutingKey(), $destination), '.');
679679
}
680680

681681
/**
@@ -735,9 +735,9 @@ protected function publishProperties($queue, array $options = []): array
735735
return [$destination, $exchange, $exchangeType, $attempts];
736736
}
737737

738-
protected function getConfig(): QueueConfig
738+
protected function getRabbitMQConfig(): QueueConfig
739739
{
740-
return $this->config;
740+
return $this->rabbitMQConfig;
741741
}
742742

743743
/**

tests/Feature/ConnectorTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class ConnectorTest extends \VladimirYuldashev\LaravelQueueRabbitMQ\Tests\TestCase
1414
{
15-
public function test_lazy_connection(): void
15+
public function testLazyConnection(): void
1616
{
1717
$this->app['config']->set('queue.connections.rabbitmq', [
1818
'driver' => 'rabbitmq',
@@ -55,7 +55,7 @@ public function test_lazy_connection(): void
5555
$this->assertTrue($connection->getConnection()->isConnected());
5656
}
5757

58-
public function test_lazy_stream_connection(): void
58+
public function testLazyStreamConnection(): void
5959
{
6060
$this->app['config']->set('queue.connections.rabbitmq', [
6161
'driver' => 'rabbitmq',
@@ -98,7 +98,7 @@ public function test_lazy_stream_connection(): void
9898
$this->assertTrue($connection->getConnection()->isConnected());
9999
}
100100

101-
public function test_ssl_connection(): void
101+
public function testSslConnection(): void
102102
{
103103
$this->markTestSkipped();
104104

@@ -142,7 +142,7 @@ public function test_ssl_connection(): void
142142
}
143143

144144
// Test to validate ssl connection params
145-
public function test_no_verification_ssl_connection(): void
145+
public function testNoVerificationSslConnection(): void
146146
{
147147
$this->app['config']->set('queue.connections.rabbitmq', [
148148
'driver' => 'rabbitmq',

tests/Feature/QueueTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ protected function setUp(): void
2020
]);
2121
}
2222

23-
public function test_connection(): void
23+
public function testConnection(): void
2424
{
2525
$this->assertInstanceOf(AMQPStreamConnection::class, $this->connection()->getChannel()->getConnection());
2626
}
2727

28-
public function test_without_reconnect(): void
28+
public function testWithoutReconnect(): void
2929
{
3030
$queue = $this->connection('rabbitmq');
3131

tests/Feature/SslQueueTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected function getEnvironmentSetUp($app): void
4343
]);
4444
}
4545

46-
public function test_connection(): void
46+
public function testConnection(): void
4747
{
4848
$this->assertInstanceOf(AMQPSSLConnection::class, $this->connection()->getChannel()->getConnection());
4949
}

tests/Feature/TestCase.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@ protected function tearDown(): void
4040
parent::tearDown();
4141
}
4242

43-
public function test_size_does_not_throw_exception_on_unknown_queue(): void
43+
public function testSizeDoesNotThrowExceptionOnUnknownQueue(): void
4444
{
4545
$this->assertEmpty(0, Queue::size(Str::random()));
4646
}
4747

48-
public function test_pop_nothing(): void
48+
public function testPopNothing(): void
4949
{
5050
$this->assertNull(Queue::pop('foo'));
5151
}
5252

53-
public function test_push_raw(): void
53+
public function testPushRaw(): void
5454
{
5555
Queue::pushRaw($payload = Str::random());
5656

@@ -68,7 +68,7 @@ public function test_push_raw(): void
6868
$this->assertSame(0, Queue::size());
6969
}
7070

71-
public function test_push(): void
71+
public function testPush(): void
7272
{
7373
Queue::push(new TestJob);
7474

@@ -95,7 +95,7 @@ public function test_push(): void
9595
$this->assertSame(0, Queue::size());
9696
}
9797

98-
public function test_push_after_commit(): void
98+
public function testPushAfterCommit(): void
9999
{
100100
$transaction = new DatabaseTransactionsManager;
101101

@@ -122,7 +122,7 @@ public function test_push_after_commit(): void
122122
$this->assertSame(0, Queue::size());
123123
}
124124

125-
public function test_later_raw(): void
125+
public function testLaterRaw(): void
126126
{
127127
$payload = Str::random();
128128
$data = [Str::random() => Str::random()];
@@ -152,7 +152,7 @@ public function test_later_raw(): void
152152
$this->assertSame(0, Queue::size());
153153
}
154154

155-
public function test_later(): void
155+
public function testLater(): void
156156
{
157157
Queue::later(3, new TestJob);
158158

@@ -179,7 +179,7 @@ public function test_later(): void
179179
$this->assertSame(0, Queue::size());
180180
}
181181

182-
public function test_bulk(): void
182+
public function testBulk(): void
183183
{
184184
$count = 100;
185185
$jobs = [];
@@ -195,7 +195,7 @@ public function test_bulk(): void
195195
$this->assertSame($count, Queue::size());
196196
}
197197

198-
public function test_push_encrypted(): void
198+
public function testPushEncrypted(): void
199199
{
200200
Queue::push(new TestEncryptedJob);
201201

@@ -222,7 +222,7 @@ public function test_push_encrypted(): void
222222
$this->assertSame(0, Queue::size());
223223
}
224224

225-
public function test_push_encrypted_after_commit(): void
225+
public function testPushEncryptedAfterCommit(): void
226226
{
227227
$transaction = new DatabaseTransactionsManager;
228228

@@ -249,7 +249,7 @@ public function test_push_encrypted_after_commit(): void
249249
$this->assertSame(0, Queue::size());
250250
}
251251

252-
public function test_encrypted_later(): void
252+
public function testEncryptedLater(): void
253253
{
254254
Queue::later(3, new TestEncryptedJob);
255255

@@ -276,7 +276,7 @@ public function test_encrypted_later(): void
276276
$this->assertSame(0, Queue::size());
277277
}
278278

279-
public function test_encrypted_bulk(): void
279+
public function testEncryptedBulk(): void
280280
{
281281
$count = 100;
282282
$jobs = [];
@@ -292,7 +292,7 @@ public function test_encrypted_bulk(): void
292292
$this->assertSame($count, Queue::size());
293293
}
294294

295-
public function test_release_raw(): void
295+
public function testReleaseRaw(): void
296296
{
297297
Queue::pushRaw($payload = Str::random());
298298

@@ -318,7 +318,7 @@ public function test_release_raw(): void
318318
$this->assertSame(0, Queue::size());
319319
}
320320

321-
public function test_release(): void
321+
public function testRelease(): void
322322
{
323323
Queue::push(new TestJob);
324324

@@ -344,7 +344,7 @@ public function test_release(): void
344344
$this->assertSame(0, Queue::size());
345345
}
346346

347-
public function test_release_with_delay_raw(): void
347+
public function testReleaseWithDelayRaw(): void
348348
{
349349
Queue::pushRaw($payload = Str::random());
350350

@@ -375,7 +375,7 @@ public function test_release_with_delay_raw(): void
375375
$this->assertSame(0, Queue::size());
376376
}
377377

378-
public function test_release_in_the_past(): void
378+
public function testReleaseInThePast(): void
379379
{
380380
Queue::push(new TestJob);
381381

@@ -390,7 +390,7 @@ public function test_release_in_the_past(): void
390390
$this->assertSame(0, Queue::size());
391391
}
392392

393-
public function test_release_and_release_with_delay_attempts(): void
393+
public function testReleaseAndReleaseWithDelayAttempts(): void
394394
{
395395
Queue::push(new TestJob);
396396

@@ -417,7 +417,7 @@ public function test_release_and_release_with_delay_attempts(): void
417417
$this->assertSame(0, Queue::size());
418418
}
419419

420-
public function test_delete(): void
420+
public function testDelete(): void
421421
{
422422
Queue::push(new TestJob);
423423

@@ -431,7 +431,7 @@ public function test_delete(): void
431431
$this->assertNull(Queue::pop());
432432
}
433433

434-
public function test_failed(): void
434+
public function testFailed(): void
435435
{
436436
Queue::push(new TestJob);
437437

0 commit comments

Comments
 (0)