|
@@ -60,6 +60,25 @@ class ScriptedCommandTest extends StandardTestCase
|
|
|
$this->assertSame(array_merge(array(self::LUA_SCRIPT_SHA1, 2), $arguments), $command->getArguments());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @group disconnected
|
|
|
+ */
|
|
|
+ public function testGetArgumentsWithZeroKeysCount()
|
|
|
+ {
|
|
|
+ $arguments = array('value1', 'value2', 'value3');
|
|
|
+
|
|
|
+ $command = $this->getMock('Predis\Command\ScriptedCommand', array('getScript', 'getKeysCount'));
|
|
|
+ $command->expects($this->once())
|
|
|
+ ->method('getScript')
|
|
|
+ ->will($this->returnValue(self::LUA_SCRIPT));
|
|
|
+ $command->expects($this->once())
|
|
|
+ ->method('getKeysCount')
|
|
|
+ ->will($this->returnValue(0));
|
|
|
+ $command->setArguments($arguments);
|
|
|
+
|
|
|
+ $this->assertSame(array_merge(array(self::LUA_SCRIPT_SHA1, 0), $arguments), $command->getArguments());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @group disconnected
|
|
|
*/
|
|
@@ -79,6 +98,25 @@ class ScriptedCommandTest extends StandardTestCase
|
|
|
$this->assertSame(array('key1', 'key2'), $command->getKeys());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @group disconnected
|
|
|
+ */
|
|
|
+ public function testGetKeysWithZeroKeysCount()
|
|
|
+ {
|
|
|
+ $arguments = array('value1', 'value2', 'value3');
|
|
|
+
|
|
|
+ $command = $this->getMock('Predis\Command\ScriptedCommand', array('getScript', 'getKeysCount'));
|
|
|
+ $command->expects($this->once())
|
|
|
+ ->method('getScript')
|
|
|
+ ->will($this->returnValue(self::LUA_SCRIPT));
|
|
|
+ $command->expects($this->exactly(2))
|
|
|
+ ->method('getKeysCount')
|
|
|
+ ->will($this->returnValue(0));
|
|
|
+ $command->setArguments($arguments);
|
|
|
+
|
|
|
+ $this->assertSame(array(), $command->getKeys());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @group disconnected
|
|
|
*/
|