Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorprogger committed Dec 7, 2024
1 parent 1cc4438 commit f982680
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 111 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ $queue = $provider->get('channel-name');
Out of the box, there are four implementations of the `QueueProviderInterface`:

- `AdapterFactoryQueueProvider`
- `QueueFactoryQueueProvider`
- `PrototypeQueueProvider`
- `CompositeQueueProvider`

Expand All @@ -195,10 +194,6 @@ use Yiisoft\Queue\Adapter\SynchronousAdapter;

For more information about a definition formats available see the [factory](https://github.com/yiisoft/factory) documentation.

### `QueueFactoryQueueProvider`

Provider is similar to `AdapterFactoryQueueProvider`, but it uses definitions of channel-specific queues.

### `PrototypeQueueProvider`

Queue provider that only changes the channel name of the base queue. It can be useful when your queues used the same
Expand Down
26 changes: 14 additions & 12 deletions tests/Unit/Provider/CompositeQueueProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,27 @@

namespace Yiisoft\Queue\Tests\Unit\Provider;

use Yiisoft\Queue\Provider\AdapterFactoryQueueProvider;
use Yiisoft\Queue\Provider\ChannelNotFoundException;
use Yiisoft\Queue\Provider\CompositeQueueProvider;
use Yiisoft\Queue\Provider\QueueFactoryQueueProvider;
use Yiisoft\Queue\Stubs\StubAdapter;
use Yiisoft\Queue\Stubs\StubQueue;
use Yiisoft\Queue\Tests\TestCase;

final class CompositeQueueProviderTest extends TestCase
{
public function testBase(): void
{
$queue = new StubQueue('channel');
$provider = new CompositeQueueProvider(
new QueueFactoryQueueProvider([
'channel1' => new StubQueue('channel1'),
]),
new QueueFactoryQueueProvider([
'channel2' => new StubQueue('channel2'),
]),
new AdapterFactoryQueueProvider(
$queue,
['channel1' => new StubAdapter()],
),
new AdapterFactoryQueueProvider(
$queue,
['channel2' => new StubAdapter()],
),
);

$this->assertTrue($provider->has('channel1'));
Expand All @@ -34,13 +38,11 @@ public function testBase(): void
public function testNotFound(): void
{
$provider = new CompositeQueueProvider(
new QueueFactoryQueueProvider([
'channel1' => new StubQueue(),
]),
new AdapterFactoryQueueProvider(new StubQueue('channel'), ['channel1' => new StubAdapter()]),
);

$this->expectException(ChannelNotFoundException::class);
$this->expectExceptionMessage('Channel "not-exist" not found.');
$provider->get('not-exist');
$this->expectExceptionMessage('Channel "not-exists" not found.');
$provider->get('not-exists');
}
}
94 changes: 0 additions & 94 deletions tests/Unit/Provider/QueueFactoryQueueProviderTest.php

This file was deleted.

4 changes: 4 additions & 0 deletions tests/Unit/QueueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ public function testAdapterNotConfiguredExceptionForRun(): void

public function testRunWithSignalLoop(): void
{
if (!extension_loaded('pcntl')) {
$this->markTestSkipped("This rest requires PCNTL extension");
}

$this->loop = new SignalLoop();
$queue = $this
->getQueue()
Expand Down

0 comments on commit f982680

Please sign in to comment.