Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 963129f

Browse filesBrowse files
committed
Add tests
1 parent fedf007 commit 963129f
Copy full SHA for 963129f

File tree

1 file changed

+40
-3
lines changed
Filter options

1 file changed

+40
-3
lines changed

‎src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/RedisTransportFactoryTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/RedisTransportFactoryTest.php
+40-3Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,59 @@ public function testSupportsOnlyRedisTransports()
2828

2929
$this->assertTrue($factory->supports('redis://localhost', []));
3030
$this->assertTrue($factory->supports('rediss://localhost', []));
31+
$this->assertTrue($factory->supports('redis:?host[host1:5000]&host[host2:5000]&host[host3:5000]&sentinel_master=test&dbindex=0', []));
3132
$this->assertFalse($factory->supports('sqs://localhost', []));
3233
$this->assertFalse($factory->supports('invalid-dsn', []));
3334
}
3435

3536
/**
3637
* @group integration
38+
* @dataProvider createProvider
3739
*/
38-
public function testCreateTransport()
40+
public function testCreateTransport(string $dsn, array $options = [])
3941
{
4042
$this->skipIfRedisUnavailable();
4143

4244
$factory = new RedisTransportFactory();
4345
$serializer = $this->createMock(SerializerInterface::class);
44-
$expectedTransport = new RedisTransport(Connection::fromDsn('redis://'.getenv('REDIS_HOST'), ['stream' => 'bar', 'delete_after_ack' => true]), $serializer);
4546

46-
$this->assertEquals($expectedTransport, $factory->createTransport('redis://'.getenv('REDIS_HOST'), ['stream' => 'bar', 'delete_after_ack' => true], $serializer));
47+
$this->assertEquals(
48+
new RedisTransport(Connection::fromDsn($dsn, $options), $serializer),
49+
$factory->createTransport($dsn, $options, $serializer)
50+
);
51+
}
52+
53+
/**
54+
* @return iterable<array{0: string, 1: array}>
55+
*/
56+
public static function createProvider(): iterable
57+
{
58+
yield 'scheme "redis" without options' => [
59+
'redis://'.getenv('REDIS_HOST'),
60+
[],
61+
];
62+
63+
yield 'scheme "rediss" without options' => [
64+
'rediss://'.getenv('REDIS_HOST'),
65+
[],
66+
67+
];
68+
69+
yield 'scheme "redis" with options' => [
70+
'redis://'.getenv('REDIS_HOST'),
71+
['stream' => 'bar', 'delete_after_ack' => true],
72+
];
73+
74+
yield 'scheme "rediss" with options' => [
75+
'rediss://'.getenv('REDIS_HOST'),
76+
['stream' => 'bar', 'delete_after_ack' => true],
77+
];
78+
79+
yield 'redis_sentinel' => [
80+
'redis:?host[host1:5000]&host[host2:5000]&host[host3:5000]&sentinel_master=test&dbindex=0',
81+
[]
82+
];
83+
4784
}
4885

4986
private function skipIfRedisUnavailable()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.