diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/RedisTest.php | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/RedisTest.php b/tests/RedisTest.php index 5f23a76a..8c358b6e 100644 --- a/tests/RedisTest.php +++ b/tests/RedisTest.php @@ -5392,7 +5392,7 @@ class Redis_Test extends TestSuite for ($n = 1; $n <= 3; $n++) { $this->addStreamsAndGroups(Array('{s}'), 3, Array('g1' => 0)); - $msg = $this->redis->xReadGroup('g1', 'c1', Array('{s}' => 0)); + $msg = $this->redis->xReadGroup('g1', 'c1', Array('{s}' => '>')); /* Extract IDs */ $smsg = array_shift($msg); @@ -5494,17 +5494,25 @@ class Redis_Test extends TestSuite /* Create some streams and groups */ $streams = Array('{s}-1', '{s}-2'); - $qstreams = Array('{s}-1' => 0, '{s}-2' => 0); $groups = Array('g1' => 0, 'g2' => 0); - $ids = $this->addStreamsAndGroups($streams, 3, $groups); + /* I'm not totally sure why Redis behaves this way, but we have to + * send '>' first and then send ID '0' for subsequent xReadGroup calls + * or Redis will not return any messages. This behavior changed from + * redis 5.0.1 and 5.0.2 but doing it this way works for both versions. */ + $qcount = 0; + $query1 = Array('{s}-1' => '>', '{s}-2' => '>'); + $query2 = Array('{s}-1' => '0', '{s}-2' => '0'); + + $ids = $this->addStreamsAndGroups($streams, 1, $groups); /* Test that we get get the IDs we should */ foreach (Array('g1', 'g2') as $group) { foreach ($ids as $stream => $messages) { while ($ids[$stream]) { /* Read more messages */ - $resp = $this->redis->xReadGroup($group, 'consumer', $qstreams); + $query = !$qcount++ ? $query1 : $query2; + $resp = $this->redis->xReadGroup($group, 'consumer', $query); /* They should match with our local control array */ $this->compareStreamIds($resp, $ids); @@ -5519,7 +5527,7 @@ class Redis_Test extends TestSuite /* Test COUNT option */ for ($c = 1; $c <= 3; $c++) { $this->addStreamsAndGroups($streams, 3, $groups); - $resp = $this->redis->xReadGroup('g1', 'consumer', $qstreams, $c); + $resp = $this->redis->xReadGroup('g1', 'consumer', $query1, $c); foreach ($resp as $stream => $smsg) { $this->assertEquals(count($smsg), $c); @@ -5624,7 +5632,7 @@ class Redis_Test extends TestSuite $fids = $fids['f']; /* Have consumer 'Mike' read the messages */ - $oids = $this->redis->xReadGroup('group1', 'Mike', Array('s' => 0)); + $oids = $this->redis->xReadGroup('group1', 'Mike', Array('s' => '>')); $oids = array_keys($oids['s']); /* We're only dealing with stream 's' */ /* Construct our options array */ |