mirror of
https://github.com/predis/predis.git
synced 2026-10-09 21:38:07 +00:00
Use 0 to indicate no arguments for KEYS[] in Lua scripted commands.
We previously used FALSE for that but in the end it does not make much sense. Luckily for us this does not represent a breaking change since existing code will keep to work, so we can safely push this change into the next patch release.
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user