mirror of
https://github.com/predis/predis.git
synced 2026-08-27 18:51:07 +00:00
Fix Predis\Commands\ServerEvalSHA::getScriptHash().
"Predis\Commands\ServerEvalSHA::getScriptHash()" was calculating the hash while it just needs to return the first argument of the command.
This commit is contained in:
@@ -11,6 +11,8 @@ v0.7.3 (2012-xx-xx)
|
||||
This bug is limited to the above mentioned example and does not affect the
|
||||
classes implemented in the `Predis\Distribution` namespace.
|
||||
|
||||
- __FIX__: `Predis\Commands\ServerEvalSHA::getScriptHash()` was calculating the
|
||||
hash while it just needs to return the first argument of the command.
|
||||
|
||||
v0.7.2 (2012-04-01)
|
||||
===============================================================================
|
||||
|
||||
@@ -24,4 +24,14 @@ class ServerEvalSHA extends ServerEval
|
||||
{
|
||||
return 'EVALSHA';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the SHA1 hash of the body of the script.
|
||||
*
|
||||
* @return string SHA1 hash.
|
||||
*/
|
||||
public function getScriptHash()
|
||||
{
|
||||
return $this->getArgument(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,15 @@ class ServerEvalSHATest extends CommandTestCase
|
||||
$this->assertSame($expected, $command->getArguments());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
public function testGetScriptHash()
|
||||
{
|
||||
$command = $this->getCommandWithArgumentsArray(array($sha1 = sha1('return true')), 0);
|
||||
$this->assertSame($sha1, $command->getScriptHash());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group connected
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user