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 20846e2

Browse filesBrowse files
committed
Add tests
1 parent fedf007 commit 20846e2
Copy full SHA for 20846e2

File tree

1 file changed

+39
-3
lines changed
Filter options

1 file changed

+39
-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
+39-3Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,58 @@ 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+
*
39+
* @dataProvider createTransportProvider
3740
*/
38-
public function testCreateTransport()
41+
public function testCreateTransport(string $dsn, array $options = [])
3942
{
4043
$this->skipIfRedisUnavailable();
4144

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

46-
$this->assertEquals($expectedTransport, $factory->createTransport('redis://'.getenv('REDIS_HOST'), ['stream' => 'bar', 'delete_after_ack' => true], $serializer));
48+
$this->assertEquals(
49+
new RedisTransport(Connection::fromDsn($dsn, $options), $serializer),
50+
$factory->createTransport($dsn, $options, $serializer)
51+
);
52+
}
53+
54+
/**
55+
* @return iterable<array{0: string, 1: array}>
56+
*/
57+
public static function createTransportProvider(): iterable
58+
{
59+
yield 'scheme "redis" without options' => [
60+
'redis://'.getenv('REDIS_HOST'),
61+
[],
62+
];
63+
64+
yield 'scheme "rediss" without options' => [
65+
'rediss://'.getenv('REDIS_HOST'),
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+
];
4783
}
4884

4985
private function skipIfRedisUnavailable()

0 commit comments

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