diff --git a/tests/Unit/Provider/CompositeQueueProviderTest.php b/tests/Unit/Provider/CompositeQueueProviderTest.php new file mode 100644 index 00000000..aaac4a94 --- /dev/null +++ b/tests/Unit/Provider/CompositeQueueProviderTest.php @@ -0,0 +1,46 @@ + new StubQueue('channel1'), + ]), + new FactoryQueueProvider([ + 'channel2' => new StubQueue('channel2'), + ]), + ); + + $this->assertTrue($provider->has('channel1')); + $this->assertTrue($provider->has('channel2')); + $this->assertFalse($provider->has('channel3')); + + $this->assertSame('channel1', $provider->get('channel1')->getChannelName()); + $this->assertSame('channel2', $provider->get('channel2')->getChannelName()); + } + + public function testNotFound(): void + { + $provider = new CompositeQueueProvider( + new FactoryQueueProvider([ + 'channel1' => new StubQueue(), + ]), + ); + + $this->expectException(ChannelNotFoundException::class); + $this->expectExceptionMessage('Channel "not-exist" not found.'); + $provider->get('not-exist'); + } +}