@@ -61,7 +61,7 @@ public function testFromInvalidDsn()
61
61
public function testFromDsn ()
62
62
{
63
63
$ this ->assertEquals (
64
- new Connection (['stream ' => 'queue ' , ' delete_after_ack ' => true ], [
64
+ new Connection (['stream ' => 'queue ' ], [
65
65
'host ' => 'localhost ' ,
66
66
'port ' => 6379 ,
67
67
]),
@@ -80,32 +80,32 @@ public function testFromDsnWithMultipleHosts()
80
80
}, $ hosts );
81
81
$ dsn = implode (', ' , $ dsn );
82
82
83
- $ this ->assertInstanceOf (Connection::class, Connection::fromDsn ($ dsn, [ ' delete_after_ack ' => true ] ));
83
+ $ this ->assertInstanceOf (Connection::class, Connection::fromDsn ($ dsn ));
84
84
}
85
85
86
86
public function testFromDsnOnUnixSocket ()
87
87
{
88
88
$ this ->assertEquals (
89
- new Connection (['stream ' => 'queue ' , ' delete_after_ack ' => true ], [
89
+ new Connection (['stream ' => 'queue ' ], [
90
90
'host ' => '/var/run/redis/redis.sock ' ,
91
91
'port ' => 0 ,
92
92
], [], $ redis = $ this ->createMock (\Redis::class)),
93
- Connection::fromDsn ('redis:///var/run/redis/redis.sock ' , ['stream ' => 'queue ' , ' delete_after_ack ' => true ], $ redis )
93
+ Connection::fromDsn ('redis:///var/run/redis/redis.sock ' , ['stream ' => 'queue ' ], $ redis )
94
94
);
95
95
}
96
96
97
97
public function testFromDsnWithOptions ()
98
98
{
99
99
$ this ->assertEquals (
100
- Connection::fromDsn ('redis://localhost ' , ['stream ' => 'queue ' , 'group ' => 'group1 ' , 'consumer ' => 'consumer1 ' , 'auto_setup ' => false , 'serializer ' => 2 , ' delete_after_ack ' => true ]),
100
+ Connection::fromDsn ('redis://localhost ' , ['stream ' => 'queue ' , 'group ' => 'group1 ' , 'consumer ' => 'consumer1 ' , 'auto_setup ' => false , 'serializer ' => 2 ]),
101
101
Connection::fromDsn ('redis://localhost/queue/group1/consumer1?serializer=2&auto_setup=0&delete_after_ack=1 ' )
102
102
);
103
103
}
104
104
105
105
public function testFromDsnWithOptionsAndTrailingSlash ()
106
106
{
107
107
$ this ->assertEquals (
108
- Connection::fromDsn ('redis://localhost/ ' , ['stream ' => 'queue ' , 'group ' => 'group1 ' , 'consumer ' => 'consumer1 ' , 'auto_setup ' => false , 'serializer ' => 2 , ' delete_after_ack ' => true ]),
108
+ Connection::fromDsn ('redis://localhost/ ' , ['stream ' => 'queue ' , 'group ' => 'group1 ' , 'consumer ' => 'consumer1 ' , 'auto_setup ' => false , 'serializer ' => 2 ]),
109
109
Connection::fromDsn ('redis://localhost/queue/group1/consumer1?serializer=2&auto_setup=0&delete_after_ack=1 ' )
110
110
);
111
111
}
@@ -124,7 +124,7 @@ public function testFromDsnWithRedissScheme()
124
124
public function testFromDsnWithQueryOptions ()
125
125
{
126
126
$ this ->assertEquals (
127
- new Connection (['stream ' => 'queue ' , 'group ' => 'group1 ' , 'consumer ' => 'consumer1 ' , ' delete_after_ack ' => true ], [
127
+ new Connection (['stream ' => 'queue ' , 'group ' => 'group1 ' , 'consumer ' => 'consumer1 ' ], [
128
128
'host ' => 'localhost ' ,
129
129
'port ' => 6379 ,
130
130
], [
@@ -137,12 +137,12 @@ public function testFromDsnWithQueryOptions()
137
137
public function testFromDsnWithMixDsnQueryOptions ()
138
138
{
139
139
$ this ->assertEquals (
140
- Connection::fromDsn ('redis://localhost/queue/group1?serializer=2 ' , ['consumer ' => 'specific-consumer ' , ' delete_after_ack ' => true ]),
140
+ Connection::fromDsn ('redis://localhost/queue/group1?serializer=2 ' , ['consumer ' => 'specific-consumer ' ]),
141
141
Connection::fromDsn ('redis://localhost/queue/group1/specific-consumer?serializer=2&delete_after_ack=1 ' )
142
142
);
143
143
144
144
$ this ->assertEquals (
145
- Connection::fromDsn ('redis://localhost/queue/group1/consumer1 ' , ['consumer ' => 'specific-consumer ' , ' delete_after_ack ' => true ]),
145
+ Connection::fromDsn ('redis://localhost/queue/group1/consumer1 ' , ['consumer ' => 'specific-consumer ' ]),
146
146
Connection::fromDsn ('redis://localhost/queue/group1/consumer1?delete_after_ack=1 ' )
147
147
);
148
148
}
@@ -163,7 +163,7 @@ public function testKeepGettingPendingMessages()
163
163
->with ('symfony ' , 'consumer ' , ['queue ' => 0 ], 1 , null )
164
164
->willReturn (['queue ' => [['message ' => '{"body":"Test","headers":[]} ' ]]]);
165
165
166
- $ connection = Connection::fromDsn ('redis://localhost/queue ' , [' delete_after_ack ' => true ], $ redis );
166
+ $ connection = Connection::fromDsn ('redis://localhost/queue ' , [], $ redis );
167
167
$ this ->assertNotNull ($ connection ->get ());
168
168
$ this ->assertNotNull ($ connection ->get ());
169
169
$ this ->assertNotNull ($ connection ->get ());
@@ -177,7 +177,7 @@ public function testAuth()
177
177
->with ('password ' )
178
178
->willReturn (true );
179
179
180
- Connection::fromDsn ('redis://password@localhost/queue ' , [' delete_after_ack ' => true ], $ redis );
180
+ Connection::fromDsn ('redis://password@localhost/queue ' , [], $ redis );
181
181
}
182
182
183
183
public function testAuthFromOptions ()
@@ -188,7 +188,7 @@ public function testAuthFromOptions()
188
188
->with ('password ' )
189
189
->willReturn (true );
190
190
191
- Connection::fromDsn ('redis://localhost/queue ' , ['auth ' => 'password ' , ' delete_after_ack ' => true ], $ redis );
191
+ Connection::fromDsn ('redis://localhost/queue ' , ['auth ' => 'password ' ], $ redis );
192
192
}
193
193
194
194
public function testAuthFromOptionsAndDsn ()
@@ -199,7 +199,7 @@ public function testAuthFromOptionsAndDsn()
199
199
->with ('password2 ' )
200
200
->willReturn (true );
201
201
202
- Connection::fromDsn ('redis://password1@localhost/queue ' , ['auth ' => 'password2 ' , ' delete_after_ack ' => true ], $ redis );
202
+ Connection::fromDsn ('redis://password1@localhost/queue ' , ['auth ' => 'password2 ' ], $ redis );
203
203
}
204
204
205
205
public function testNoAuthWithEmptyPassword ()
@@ -210,7 +210,7 @@ public function testNoAuthWithEmptyPassword()
210
210
->with ('' )
211
211
->willThrowException (new \RuntimeException ());
212
212
213
- Connection::fromDsn ('redis://@localhost/queue ' , [' delete_after_ack ' => true ], $ redis );
213
+ Connection::fromDsn ('redis://@localhost/queue ' , [], $ redis );
214
214
}
215
215
216
216
public function testAuthZeroPassword ()
@@ -221,7 +221,7 @@ public function testAuthZeroPassword()
221
221
->with ('0 ' )
222
222
->willReturn (true );
223
223
224
- Connection::fromDsn ('redis://0@localhost/queue ' , [' delete_after_ack ' => true ], $ redis );
224
+ Connection::fromDsn ('redis://0@localhost/queue ' , [], $ redis );
225
225
}
226
226
227
227
public function testFailedAuth ()
@@ -234,14 +234,14 @@ public function testFailedAuth()
234
234
->with ('password ' )
235
235
->willReturn (false );
236
236
237
- Connection::fromDsn ('redis://password@localhost/queue ' , [' delete_after_ack ' => true ], $ redis );
237
+ Connection::fromDsn ('redis://password@localhost/queue ' , [], $ redis );
238
238
}
239
239
240
240
public function testDbIndex ()
241
241
{
242
242
$ redis = new \Redis ();
243
243
244
- Connection::fromDsn ('redis://localhost/queue?dbindex=2 ' , [' delete_after_ack ' => true ], $ redis );
244
+ Connection::fromDsn ('redis://localhost/queue?dbindex=2 ' , [], $ redis );
245
245
246
246
$ this ->assertSame (2 , $ redis ->getDbNum ());
247
247
}
@@ -254,7 +254,7 @@ public function testGetPendingMessageFirst()
254
254
->with ('symfony ' , 'consumer ' , ['queue ' => '0 ' ], 1 , null )
255
255
->willReturn (['queue ' => [['message ' => '{"body":"1","headers":[]} ' ]]]);
256
256
257
- $ connection = Connection::fromDsn ('redis://localhost/queue ' , [' delete_after_ack ' => true ], $ redis );
257
+ $ connection = Connection::fromDsn ('redis://localhost/queue ' , [], $ redis );
258
258
$ connection ->get ();
259
259
}
260
260
@@ -280,7 +280,7 @@ public function testClaimAbandonedMessageWithRaceCondition()
280
280
->with ('queue ' , 'symfony ' , 'consumer ' , 3600000 , ['redisid-123 ' ], ['JUSTID ' ])
281
281
->willReturn ([]);
282
282
283
- $ connection = Connection::fromDsn ('redis://localhost/queue ' , [' delete_after_ack ' => true ], $ redis );
283
+ $ connection = Connection::fromDsn ('redis://localhost/queue ' , [], $ redis );
284
284
$ connection ->get ();
285
285
}
286
286
@@ -308,7 +308,7 @@ public function testClaimAbandonedMessage()
308
308
->with ('queue ' , 'symfony ' , 'consumer ' , 3600000 , ['redisid-123 ' ], ['JUSTID ' ])
309
309
->willReturn ([]);
310
310
311
- $ connection = Connection::fromDsn ('redis://localhost/queue ' , [' delete_after_ack ' => true ], $ redis );
311
+ $ connection = Connection::fromDsn ('redis://localhost/queue ' , [], $ redis );
312
312
$ connection ->get ();
313
313
}
314
314
@@ -320,22 +320,22 @@ public function testUnexpectedRedisError()
320
320
$ redis ->expects ($ this ->once ())->method ('xreadgroup ' )->willReturn (false );
321
321
$ redis ->expects ($ this ->once ())->method ('getLastError ' )->willReturn ('Redis error happens ' );
322
322
323
- $ connection = Connection::fromDsn ('redis://localhost/queue ' , ['auto_setup ' => false , ' delete_after_ack ' => true ], $ redis );
323
+ $ connection = Connection::fromDsn ('redis://localhost/queue ' , ['auto_setup ' => false ], $ redis );
324
324
$ connection ->get ();
325
325
}
326
326
327
327
public function testGetAfterReject ()
328
328
{
329
329
$ redis = new \Redis ();
330
- $ connection = Connection::fromDsn ('redis://localhost/messenger-rejectthenget ' , [' delete_after_ack ' => true ], $ redis );
330
+ $ connection = Connection::fromDsn ('redis://localhost/messenger-rejectthenget ' , [], $ redis );
331
331
332
332
$ connection ->add ('1 ' , []);
333
333
$ connection ->add ('2 ' , []);
334
334
335
335
$ failing = $ connection ->get ();
336
336
$ connection ->reject ($ failing ['id ' ]);
337
337
338
- $ connection = Connection::fromDsn ('redis://localhost/messenger-rejectthenget ' , [ ' delete_after_ack ' => true ] );
338
+ $ connection = Connection::fromDsn ('redis://localhost/messenger-rejectthenget ' );
339
339
$ this ->assertNotNull ($ connection ->get ());
340
340
341
341
$ redis ->del ('messenger-rejectthenget ' );
@@ -345,7 +345,7 @@ public function testGetNonBlocking()
345
345
{
346
346
$ redis = new \Redis ();
347
347
348
- $ connection = Connection::fromDsn ('redis://localhost/messenger-getnonblocking ' , [' delete_after_ack ' => true ], $ redis );
348
+ $ connection = Connection::fromDsn ('redis://localhost/messenger-getnonblocking ' , [], $ redis );
349
349
350
350
$ this ->assertNull ($ connection ->get ()); // no message, should return null immediately
351
351
$ connection ->add ('1 ' , []);
@@ -357,7 +357,7 @@ public function testGetNonBlocking()
357
357
public function testJsonError ()
358
358
{
359
359
$ redis = new \Redis ();
360
- $ connection = Connection::fromDsn ('redis://localhost/json-error ' , [' delete_after_ack ' => true ], $ redis );
360
+ $ connection = Connection::fromDsn ('redis://localhost/json-error ' , [], $ redis );
361
361
try {
362
362
$ connection ->add ("\xB1\x31" , []);
363
363
} catch (TransportException $ e ) {
@@ -374,7 +374,7 @@ public function testMaxEntries()
374
374
->with ('queue ' , '* ' , ['message ' => '{"body":"1","headers":[]} ' ], 20000 , true )
375
375
->willReturn (1 );
376
376
377
- $ connection = Connection::fromDsn ('redis://localhost/queue?stream_max_entries=20000 ' , [' delete_after_ack ' => true ], $ redis );
377
+ $ connection = Connection::fromDsn ('redis://localhost/queue?stream_max_entries=20000 ' , [], $ redis );
378
378
$ connection ->add ('1 ' , []);
379
379
}
380
380
@@ -393,16 +393,6 @@ public function testDeleteAfterAck()
393
393
$ connection ->ack ('1 ' );
394
394
}
395
395
396
- /**
397
- * @group legacy
398
- */
399
- public function testLegacyOmitDeleteAfterAck ()
400
- {
401
- $ this ->expectDeprecation ('Since symfony/redis-messenger 5.4: Not setting the "delete_after_ack" boolean option explicitly is deprecated, its default value will change to true in 6.0. ' );
402
-
403
- Connection::fromDsn ('redis://localhost/queue ' );
404
- }
405
-
406
396
public function testDeleteAfterReject ()
407
397
{
408
398
$ redis = $ this ->createMock (\Redis::class);
@@ -414,7 +404,7 @@ public function testDeleteAfterReject()
414
404
->with ('queue ' , ['1 ' ])
415
405
->willReturn (1 );
416
406
417
- $ connection = Connection::fromDsn ('redis://localhost/queue?delete_after_reject=true ' , [' delete_after_ack ' => true ], $ redis );
407
+ $ connection = Connection::fromDsn ('redis://localhost/queue?delete_after_reject=true ' , [], $ redis );
418
408
$ connection ->reject ('1 ' );
419
409
}
420
410
@@ -428,7 +418,7 @@ public function testLastErrorGetsCleared()
428
418
$ redis ->method ('getLastError ' )->willReturnOnConsecutiveCalls ('xadd error ' , 'xack error ' );
429
419
$ redis ->expects ($ this ->exactly (2 ))->method ('clearLastError ' );
430
420
431
- $ connection = Connection::fromDsn ('redis://localhost/messenger-clearlasterror ' , ['auto_setup ' => false , ' delete_after_ack ' => true ], $ redis );
421
+ $ connection = Connection::fromDsn ('redis://localhost/messenger-clearlasterror ' , ['auto_setup ' => false ], $ redis );
432
422
433
423
try {
434
424
$ connection ->add ('message ' , []);
@@ -448,7 +438,7 @@ public function testLastErrorGetsCleared()
448
438
public function testLazy ()
449
439
{
450
440
$ redis = new \Redis ();
451
- $ connection = Connection::fromDsn ('redis://localhost/messenger-lazy?lazy=1 ' , [' delete_after_ack ' => true ], $ redis );
441
+ $ connection = Connection::fromDsn ('redis://localhost/messenger-lazy?lazy=1 ' , [], $ redis );
452
442
453
443
$ connection ->add ('1 ' , []);
454
444
$ this ->assertNotEmpty ($ message = $ connection ->get ());
@@ -464,7 +454,7 @@ public function testLazyCluster()
464
454
$ connection = new Connection (
465
455
['lazy ' => true ],
466
456
['host ' => explode (' ' , getenv ('REDIS_CLUSTER_HOSTS ' ))],
467
- [' delete_after_ack ' => true ]
457
+ []
468
458
);
469
459
470
460
$ connection ->add ('1 ' , []);
0 commit comments