From 94c4e2ffeee8d3fe8455add844ad8806f5956b58 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Sat, 16 Mar 2013 16:24:59 +0100 Subject: [PATCH] Fix handling of scripted commands with redis-cluster hash strategy. A missing "use" directive was preventing the hash strategy to properly use the specific methods of Predis\Command\ScriptedCommand, falling back to analyzing the raw arguments array of the command. --- lib/Predis/Cluster/RedisClusterHashStrategy.php | 1 + tests/Predis/Cluster/RedisClusterHashStrategyTest.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Predis/Cluster/RedisClusterHashStrategy.php b/lib/Predis/Cluster/RedisClusterHashStrategy.php index 08ef8868..bec2bf59 100644 --- a/lib/Predis/Cluster/RedisClusterHashStrategy.php +++ b/lib/Predis/Cluster/RedisClusterHashStrategy.php @@ -13,6 +13,7 @@ namespace Predis\Cluster; use Predis\Cluster\Hash\CRC16HashGenerator; use Predis\Command\CommandInterface; +use Predis\Command\ScriptedCommand; /** * Default class used by Predis to calculate hashes out of keys of diff --git a/tests/Predis/Cluster/RedisClusterHashStrategyTest.php b/tests/Predis/Cluster/RedisClusterHashStrategyTest.php index 4b05d186..cf45cd97 100644 --- a/tests/Predis/Cluster/RedisClusterHashStrategyTest.php +++ b/tests/Predis/Cluster/RedisClusterHashStrategyTest.php @@ -186,7 +186,7 @@ class RedisClusterHashStrategyTest extends StandardTestCase $command->expects($this->once()) ->method('getScript') ->will($this->returnValue('return true')); - $command->expects($this->exactly(1)) + $command->expects($this->exactly(2)) ->method('getKeysCount') ->will($this->returnValue(1)); $command->setArguments($arguments);