Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 505631b

Browse files
committed
Fix broken Redis mocks
Signed-off-by: Alexander M. Turek <[email protected]>
1 parent c80fe58 commit 505631b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/ConnectionTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function testFromDsnWithTls()
7878
$redis->expects($this->once())
7979
->method('connect')
8080
->with('tls://127.0.0.1', 6379)
81-
->willReturn(null);
81+
->willReturn(true);
8282

8383
Connection::fromDsn('redis://127.0.0.1?tls=1', [], $redis);
8484
}
@@ -92,7 +92,7 @@ public function testFromDsnWithTlsOption()
9292
$redis->expects($this->once())
9393
->method('connect')
9494
->with('tls://127.0.0.1', 6379)
95-
->willReturn(null);
95+
->willReturn(true);
9696

9797
Connection::fromDsn('redis://127.0.0.1', ['tls' => true], $redis);
9898
}
@@ -103,7 +103,7 @@ public function testFromDsnWithRedissScheme()
103103
$redis->expects($this->once())
104104
->method('connect')
105105
->with('tls://127.0.0.1', 6379)
106-
->willReturn(null);
106+
->willReturn(true);
107107

108108
Connection::fromDsn('rediss://127.0.0.1', [], $redis);
109109
}
@@ -315,7 +315,7 @@ public function testMaxEntries()
315315

316316
$redis->expects($this->exactly(1))->method('xadd')
317317
->with('queue', '*', ['message' => '{"body":"1","headers":[]}'], 20000, true)
318-
->willReturn(1);
318+
->willReturn('1');
319319

320320
$connection = Connection::fromDsn('redis://localhost/queue?stream_max_entries=20000', [], $redis); // 1 = always
321321
$connection->add('1', []);
@@ -327,10 +327,10 @@ public function testDeleteAfterAck()
327327

328328
$redis->expects($this->exactly(1))->method('xack')
329329
->with('queue', 'symfony', ['1'])
330-
->willReturn(1);
330+
->willReturn('1');
331331
$redis->expects($this->exactly(1))->method('xdel')
332332
->with('queue', ['1'])
333-
->willReturn(1);
333+
->willReturn('1');
334334

335335
$connection = Connection::fromDsn('redis://localhost/queue?delete_after_ack=true', [], $redis); // 1 = always
336336
$connection->ack('1');
@@ -342,10 +342,10 @@ public function testDeleteAfterReject()
342342

343343
$redis->expects($this->exactly(1))->method('xack')
344344
->with('queue', 'symfony', ['1'])
345-
->willReturn(1);
345+
->willReturn('1');
346346
$redis->expects($this->exactly(1))->method('xdel')
347347
->with('queue', ['1'])
348-
->willReturn(1);
348+
->willReturn('1');
349349

350350
$connection = Connection::fromDsn('redis://localhost/queue?delete_after_reject=true', [], $redis); // 1 = always
351351
$connection->reject('1');
@@ -355,8 +355,8 @@ public function testLastErrorGetsCleared()
355355
{
356356
$redis = $this->createMock(\Redis::class);
357357

358-
$redis->expects($this->once())->method('xadd')->willReturn(0);
359-
$redis->expects($this->once())->method('xack')->willReturn(0);
358+
$redis->expects($this->once())->method('xadd')->willReturn('0');
359+
$redis->expects($this->once())->method('xack')->willReturn('0');
360360

361361
$redis->method('getLastError')->willReturnOnConsecutiveCalls('xadd error', 'xack error');
362362
$redis->expects($this->exactly(2))->method('clearLastError');

0 commit comments

Comments
 (0)