@@ -25,7 +25,7 @@ public function testThrowNeitherArrayStringNorNullGivenAsConfig()
25
25
public function testThrowIfSchemeIsNotAmqp ()
26
26
{
27
27
$ this ->expectException (\LogicException::class);
28
- $ this ->expectExceptionMessage ('The given DSN "http://example.com" is not supported. Must start with "redis:". ' );
28
+ $ this ->expectExceptionMessage ('The given DSN "http://example.com" is not supported. Must start with "redis:" or "rediss:" . ' );
29
29
30
30
new RedisConnectionFactory ('http://example.com ' );
31
31
}
@@ -57,6 +57,15 @@ public function testCouldBeCreatedWithRedisInstance()
57
57
$ this ->assertSame ($ redisMock , $ context ->getRedis ());
58
58
}
59
59
60
+ public function testThrowIfRedissConnectionUsedWithPhpRedisExtension ()
61
+ {
62
+ $ factory = new RedisConnectionFactory ('rediss:?vendor=phpredis ' );
63
+
64
+ $ this ->expectException (\LogicException::class);
65
+ $ this ->expectExceptionMessage ('The phpredis extension does not support secured connections. Try to use predis library as vendor. ' );
66
+ $ factory ->createContext ();
67
+ }
68
+
60
69
/**
61
70
* @dataProvider provideConfigs
62
71
*
@@ -76,6 +85,7 @@ public static function provideConfigs()
76
85
null ,
77
86
[
78
87
'host ' => 'localhost ' ,
88
+ 'scheme ' => 'redis ' ,
79
89
'port ' => 6379 ,
80
90
'timeout ' => null ,
81
91
'reserved ' => null ,
@@ -92,6 +102,7 @@ public static function provideConfigs()
92
102
'redis: ' ,
93
103
[
94
104
'host ' => 'localhost ' ,
105
+ 'scheme ' => 'redis ' ,
95
106
'port ' => 6379 ,
96
107
'timeout ' => null ,
97
108
'reserved ' => null ,
@@ -108,6 +119,7 @@ public static function provideConfigs()
108
119
[],
109
120
[
110
121
'host ' => 'localhost ' ,
122
+ 'scheme ' => 'redis ' ,
111
123
'port ' => 6379 ,
112
124
'timeout ' => null ,
113
125
'reserved ' => null ,
@@ -124,6 +136,7 @@ public static function provideConfigs()
124
136
'redis://localhost:1234?foo=bar&lazy=0&persisted=true&database=5 ' ,
125
137
[
126
138
'host ' => 'localhost ' ,
139
+ 'scheme ' => 'redis ' ,
127
140
'port ' => 1234 ,
128
141
'timeout ' => null ,
129
142
'reserved ' => null ,
@@ -142,6 +155,7 @@ public static function provideConfigs()
142
155
'redis://localhost:1234?foo=bar&lazy=0&vendor=predis ' ,
143
156
[
144
157
'host ' => 'localhost ' ,
158
+ 'scheme ' => 'redis ' ,
145
159
'port ' => 1234 ,
146
160
'timeout ' => null ,
147
161
'reserved ' => null ,
@@ -151,7 +165,6 @@ public static function provideConfigs()
151
165
'lazy ' => false ,
152
166
'foo ' => 'bar ' ,
153
167
'database ' => 0 ,
154
- 'scheme ' => 'redis ' ,
155
168
'redis ' => null ,
156
169
],
157
170
];
@@ -161,6 +174,7 @@ public static function provideConfigs()
161
174
'rediss://localhost:1234?foo=bar&lazy=0&vendor=predis ' ,
162
175
[
163
176
'host ' => 'localhost ' ,
177
+ 'scheme ' => 'rediss ' ,
164
178
'port ' => 1234 ,
165
179
'timeout ' => null ,
166
180
'reserved ' => null ,
@@ -170,17 +184,15 @@ public static function provideConfigs()
170
184
'lazy ' => false ,
171
185
'foo ' => 'bar ' ,
172
186
'database ' => 0 ,
173
- 'scheme ' => 'rediss ' ,
174
187
'redis ' => null ,
175
188
],
176
189
];
177
190
178
-
179
-
180
191
yield [
181
192
['host ' => 'localhost ' , 'port ' => 1234 , 'foo ' => 'bar ' ],
182
193
[
183
194
'host ' => 'localhost ' ,
195
+ 'scheme ' => 'redis ' ,
184
196
'port ' => 1234 ,
185
197
'timeout ' => null ,
186
198
'reserved ' => null ,
@@ -199,6 +211,7 @@ public static function provideConfigs()
199
211
'redis://h:asdfqwer1234asdf@ec2-111-1-1-1.compute-1.amazonaws.com:111 ' ,
200
212
[
201
213
'host ' => 'ec2-111-1-1-1.compute-1.amazonaws.com ' ,
214
+ 'scheme ' => 'redis ' ,
202
215
'port ' => 111 ,
203
216
'timeout ' => null ,
204
217
'reserved ' => null ,
0 commit comments