Explorar o código

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.
Daniele Alessandri %!s(int64=12) %!d(string=hai) anos
pai
achega
94c4e2ffee

+ 1 - 0
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

+ 1 - 1
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);