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:
Daniele Alessandri
2012-04-28 01:25:17 +02:00
parent 6ba1890da9
commit b67dab9ab1
3 changed files with 21 additions and 0 deletions
+2
View File
@@ -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)
===============================================================================
+10
View File
@@ -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
*/