From da009e59dd5a0096ea0b65dbd5f91ff16fe737c3 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Mon, 23 May 2016 15:53:30 +0200 Subject: [PATCH] [tests] Test count argument for SPOP in Redis 3.2. --- tests/Predis/Command/SetPopTest.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/Predis/Command/SetPopTest.php b/tests/Predis/Command/SetPopTest.php index bb337a02..87b13c26 100644 --- a/tests/Predis/Command/SetPopTest.php +++ b/tests/Predis/Command/SetPopTest.php @@ -38,8 +38,8 @@ class SetPopTest extends PredisCommandTestCase */ public function testFilterArguments() { - $arguments = array('key'); - $expected = array('key'); + $arguments = array('key', 2); + $expected = array('key', 2); $command = $this->getCommand(); $command->setArguments($arguments); @@ -70,6 +70,22 @@ class SetPopTest extends PredisCommandTestCase $this->assertNull($redis->spop('letters')); } + /** + * @group connected + * @requiresRedisVersion >= 3.2.0 + */ + public function testPopsMoreRandomMembersFromSet() + { + $redis = $this->getClient(); + + $redis->sadd('letters', 'a', 'b', 'c'); + + $this->assertSameValues(array('a', 'b', 'c'), $redis->spop('letters', 3)); + $this->assertEmpty($redis->spop('letters', 3)); + + $this->assertNull($redis->spop('letters')); + } + /** * @group connected * @expectedException \Predis\Response\ServerException