Permalink
Browse files

Avoid channels reordering issues when testing UNSUBSCRIBE.

When using UNSUBSCRIBE without a list of channels (which actually means
"unsubscribe from all the subscribed channels") Redis 2.6 does not
guarantee that channels are returned following the same order of
subscription.
  • Loading branch information...
nrk committed Nov 13, 2012
1 parent a4760d6 commit b26d6103a62b0eff495b785ec15edf0ad7020ea8
Showing with 4 additions and 2 deletions.
  1. +4 −2 tests/Predis/Command/PubSubUnsubscribeTest.php
@@ -132,8 +132,10 @@ public function testUnsubscribesFromAllSubscribedChannels()
$this->assertSame(array('subscribe', 'channel:foo', 1), $redis->subscribe('channel:foo'));
$this->assertSame(array('subscribe', 'channel:bar', 2), $redis->subscribe('channel:bar'));
- $this->assertSame(array('unsubscribe', 'channel:foo', 1), $redis->unsubscribe());
- $this->assertSame(array('unsubscribe', 'channel:bar', 0), $redis->getConnection()->read());
+ list($_, $unsubscribed1, $_) = $redis->unsubscribe();
+ list($_, $unsubscribed2, $_) = $redis->getConnection()->read();
+ $this->assertSameValues(array('channel:foo', 'channel:bar'), array($unsubscribed1, $unsubscribed2));
+
$this->assertSame('echoed', $redis->echo('echoed'));
}
}

0 comments on commit b26d610

Please sign in to comment.