Browse Source

Make sure key prefixing is skipped when command has no arguments.

Actually this was already the case for certain commands, but some of them
was left unguarded for such cases. This commit also fixes #109.

The behaviour of silently skipping key prefixing when a command has no
arguments may change in the future so we added explicit tests as guards
for future changes. Predis\Command\Processor\KeyPrefixProcessor will
continue to skip key prefixing on empty arguments, regardless.
Daniele Alessandri 12 years ago
parent
commit
6e2fd181f1
100 changed files with 1108 additions and 62 deletions
  1. 3 0
      CHANGELOG.md
  2. 11 0
      bin/generate-command-test.php
  3. 24 23
      lib/Predis/Command/KeySort.php
  4. 26 23
      lib/Predis/Command/PrefixHelpers.php
  5. 1 1
      lib/Predis/Command/Processor/KeyPrefixProcessor.php
  6. 5 5
      lib/Predis/Command/ServerEval.php
  7. 7 7
      lib/Predis/Command/ZSetUnionStore.php
  8. 11 0
      tests/Predis/Command/HashDeleteTest.php
  9. 11 0
      tests/Predis/Command/HashExistsTest.php
  10. 11 0
      tests/Predis/Command/HashGetAllTest.php
  11. 11 0
      tests/Predis/Command/HashGetMultipleTest.php
  12. 11 0
      tests/Predis/Command/HashGetTest.php
  13. 11 0
      tests/Predis/Command/HashIncrementByFloatTest.php
  14. 11 0
      tests/Predis/Command/HashIncrementByTest.php
  15. 11 0
      tests/Predis/Command/HashKeysTest.php
  16. 11 0
      tests/Predis/Command/HashLengthTest.php
  17. 11 0
      tests/Predis/Command/HashSetMultipleTest.php
  18. 11 0
      tests/Predis/Command/HashSetPreserveTest.php
  19. 11 0
      tests/Predis/Command/HashSetTest.php
  20. 11 0
      tests/Predis/Command/HashValuesTest.php
  21. 11 0
      tests/Predis/Command/KeyDeleteTest.php
  22. 11 0
      tests/Predis/Command/KeyDumpTest.php
  23. 11 0
      tests/Predis/Command/KeyExistsTest.php
  24. 11 0
      tests/Predis/Command/KeyExpireAtTest.php
  25. 11 0
      tests/Predis/Command/KeyExpireTest.php
  26. 11 0
      tests/Predis/Command/KeyKeysTest.php
  27. 11 0
      tests/Predis/Command/KeyKeysV12xTest.php
  28. 11 0
      tests/Predis/Command/KeyMoveTest.php
  29. 11 0
      tests/Predis/Command/KeyPersistTest.php
  30. 11 0
      tests/Predis/Command/KeyPreciseExpireAtTest.php
  31. 11 0
      tests/Predis/Command/KeyPreciseExpireTest.php
  32. 11 0
      tests/Predis/Command/KeyPreciseTimeToLiveTest.php
  33. 11 0
      tests/Predis/Command/KeyRenamePreserveTest.php
  34. 11 0
      tests/Predis/Command/KeyRenameTest.php
  35. 11 0
      tests/Predis/Command/KeyRestoreTest.php
  36. 11 0
      tests/Predis/Command/KeySortTest.php
  37. 11 0
      tests/Predis/Command/KeyTimeToLiveTest.php
  38. 11 0
      tests/Predis/Command/KeyTypeTest.php
  39. 11 0
      tests/Predis/Command/ListIndexTest.php
  40. 11 0
      tests/Predis/Command/ListInsertTest.php
  41. 11 0
      tests/Predis/Command/ListLengthTest.php
  42. 11 0
      tests/Predis/Command/ListPopFirstBlockingTest.php
  43. 11 0
      tests/Predis/Command/ListPopFirstTest.php
  44. 11 0
      tests/Predis/Command/ListPopLastBlockingTest.php
  45. 11 0
      tests/Predis/Command/ListPopLastPushHeadBlockingTest.php
  46. 11 0
      tests/Predis/Command/ListPopLastPushHeadTest.php
  47. 11 0
      tests/Predis/Command/ListPopLastTest.php
  48. 11 0
      tests/Predis/Command/ListPushHeadTest.php
  49. 11 0
      tests/Predis/Command/ListPushHeadXTest.php
  50. 11 0
      tests/Predis/Command/ListPushTailTest.php
  51. 11 0
      tests/Predis/Command/ListPushTailXTest.php
  52. 11 0
      tests/Predis/Command/ListRangeTest.php
  53. 11 0
      tests/Predis/Command/ListRemoveTest.php
  54. 11 0
      tests/Predis/Command/ListSetTest.php
  55. 11 0
      tests/Predis/Command/ListTrimTest.php
  56. 20 3
      tests/Predis/Command/Processor/KeyPrefixProcessorTest.php
  57. 11 0
      tests/Predis/Command/PubSubPublishTest.php
  58. 11 0
      tests/Predis/Command/PubSubSubscribeByPatternTest.php
  59. 11 0
      tests/Predis/Command/PubSubSubscribeTest.php
  60. 11 0
      tests/Predis/Command/PubSubUnsubscribeByPatternTest.php
  61. 11 0
      tests/Predis/Command/PubSubUnsubscribeTest.php
  62. 11 0
      tests/Predis/Command/ServerEvalSHATest.php
  63. 11 0
      tests/Predis/Command/ServerEvalTest.php
  64. 11 0
      tests/Predis/Command/SetAddTest.php
  65. 11 0
      tests/Predis/Command/SetCardinalityTest.php
  66. 11 0
      tests/Predis/Command/SetDifferenceStoreTest.php
  67. 11 0
      tests/Predis/Command/SetDifferenceTest.php
  68. 11 0
      tests/Predis/Command/SetIntersectionStoreTest.php
  69. 11 0
      tests/Predis/Command/SetIntersectionTest.php
  70. 11 0
      tests/Predis/Command/SetIsMemberTest.php
  71. 11 0
      tests/Predis/Command/SetMembersTest.php
  72. 11 0
      tests/Predis/Command/SetMoveTest.php
  73. 11 0
      tests/Predis/Command/SetPopTest.php
  74. 11 0
      tests/Predis/Command/SetRandomMemberTest.php
  75. 11 0
      tests/Predis/Command/SetRemoveTest.php
  76. 11 0
      tests/Predis/Command/SetUnionStoreTest.php
  77. 11 0
      tests/Predis/Command/SetUnionTest.php
  78. 11 0
      tests/Predis/Command/StringAppendTest.php
  79. 11 0
      tests/Predis/Command/StringBitCountTest.php
  80. 11 0
      tests/Predis/Command/StringBitOpTest.php
  81. 11 0
      tests/Predis/Command/StringDecrementByTest.php
  82. 11 0
      tests/Predis/Command/StringDecrementTest.php
  83. 11 0
      tests/Predis/Command/StringGetBitTest.php
  84. 10 0
      tests/Predis/Command/StringGetMultipleTest.php
  85. 11 0
      tests/Predis/Command/StringGetRangeTest.php
  86. 11 0
      tests/Predis/Command/StringGetSetTest.php
  87. 11 0
      tests/Predis/Command/StringGetTest.php
  88. 11 0
      tests/Predis/Command/StringIncrementByFloatTest.php
  89. 11 0
      tests/Predis/Command/StringIncrementByTest.php
  90. 11 0
      tests/Predis/Command/StringIncrementTest.php
  91. 11 0
      tests/Predis/Command/StringPreciseSetExpireTest.php
  92. 11 0
      tests/Predis/Command/StringSetBitTest.php
  93. 11 0
      tests/Predis/Command/StringSetExpireTest.php
  94. 11 0
      tests/Predis/Command/StringSetMultiplePreserveTest.php
  95. 11 0
      tests/Predis/Command/StringSetMultipleTest.php
  96. 11 0
      tests/Predis/Command/StringSetRangeTest.php
  97. 11 0
      tests/Predis/Command/StringSetTest.php
  98. 11 0
      tests/Predis/Command/StringStrlenTest.php
  99. 11 0
      tests/Predis/Command/StringSubstrTest.php
  100. 11 0
      tests/Predis/Command/TransactionWatchTest.php

+ 3 - 0
CHANGELOG.md

@@ -10,6 +10,9 @@ v0.8.4 (2013-xx-xx)
   and `ZREVRANGEBYSCORE` only when the options array passed to these commands
   has `WITHSCORES` set to `true` (ISSUE #107).
 
+- __FIX__: scripted commands falling back from `EVALSHA` to `EVAL` resulted in
+  PHP errors when using a prefixed client (ISSUE #109).
+
 
 v0.8.3 (2013-02-18)
 ===============================================================================

+ 11 - 0
bin/generate-command-test.php

@@ -247,6 +247,17 @@ PHP;
         \$this->assertSame(\$expected, \$command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        \$command = \$this->getCommand();
+        \$command->prefixKeys('prefix:');
+
+        \$this->assertSame(array(), \$command->getArguments());
+    }
+
 PHP;
         }
 

+ 24 - 23
lib/Predis/Command/KeySort.php

@@ -86,31 +86,32 @@ class KeySort extends AbstractCommand implements PrefixableCommandInterface
      */
     public function prefixKeys($prefix)
     {
-        $arguments = $this->getArguments();
-        $arguments[0] = "$prefix{$arguments[0]}";
-
-        if (($count = count($arguments)) > 1) {
-            for ($i = 1; $i < $count; $i++) {
-                switch ($arguments[$i]) {
-                    case 'BY':
-                    case 'STORE':
-                        $arguments[$i] = "$prefix{$arguments[++$i]}";
-                        break;
-
-                    case 'GET':
-                        $value = $arguments[++$i];
-                        if ($value !== '#') {
-                            $arguments[$i] = "$prefix$value";
-                        }
-                        break;
-
-                    case 'LIMIT';
-                        $i += 2;
-                        break;
+        if ($arguments = $this->getArguments()) {
+            $arguments[0] = "$prefix{$arguments[0]}";
+
+            if (($count = count($arguments)) > 1) {
+                for ($i = 1; $i < $count; $i++) {
+                    switch ($arguments[$i]) {
+                        case 'BY':
+                        case 'STORE':
+                            $arguments[$i] = "$prefix{$arguments[++$i]}";
+                            break;
+
+                        case 'GET':
+                            $value = $arguments[++$i];
+                            if ($value !== '#') {
+                                $arguments[$i] = "$prefix$value";
+                            }
+                            break;
+
+                        case 'LIMIT';
+                            $i += 2;
+                            break;
+                    }
                 }
             }
-        }
 
-        $this->setRawArguments($arguments);
+            $this->setRawArguments($arguments);
+        }
     }
 }

+ 26 - 23
lib/Predis/Command/PrefixHelpers.php

@@ -40,13 +40,13 @@ class PrefixHelpers
      */
     public static function all(CommandInterface $command, $prefix)
     {
-        $arguments = $command->getArguments();
+        if ($arguments = $command->getArguments()) {
+            foreach ($arguments as &$key) {
+                $key = "$prefix$key";
+            }
 
-        foreach ($arguments as &$key) {
-            $key = "$prefix$key";
+            $command->setRawArguments($arguments);
         }
-
-        $command->setRawArguments($arguments);
     }
 
     /**
@@ -57,14 +57,15 @@ class PrefixHelpers
      */
     public static function interleaved(CommandInterface $command, $prefix)
     {
-        $arguments = $command->getArguments();
-        $length = count($arguments);
+        if ($arguments = $command->getArguments()) {
+            $length = count($arguments);
 
-        for ($i = 0; $i < $length; $i += 2) {
-            $arguments[$i] = "$prefix{$arguments[$i]}";
-        }
+            for ($i = 0; $i < $length; $i += 2) {
+                $arguments[$i] = "$prefix{$arguments[$i]}";
+            }
 
-        $command->setRawArguments($arguments);
+            $command->setRawArguments($arguments);
+        }
     }
 
     /**
@@ -75,14 +76,15 @@ class PrefixHelpers
      */
     public static function skipFirst(CommandInterface $command, $prefix)
     {
-        $arguments = $command->getArguments();
-        $length = count($arguments);
+        if ($arguments = $command->getArguments()) {
+            $length = count($arguments);
 
-        for ($i = 1; $i < $length; $i++) {
-            $arguments[$i] = "$prefix{$arguments[$i]}";
-        }
+            for ($i = 1; $i < $length; $i++) {
+                $arguments[$i] = "$prefix{$arguments[$i]}";
+            }
 
-        $command->setRawArguments($arguments);
+            $command->setRawArguments($arguments);
+        }
     }
 
     /**
@@ -93,13 +95,14 @@ class PrefixHelpers
      */
     public static function skipLast(CommandInterface $command, $prefix)
     {
-        $arguments = $command->getArguments();
-        $length = count($arguments);
+        if ($arguments = $command->getArguments()) {
+            $length = count($arguments);
 
-        for ($i = 0; $i < $length - 1; $i++) {
-            $arguments[$i] = "$prefix{$arguments[$i]}";
-        }
+            for ($i = 0; $i < $length - 1; $i++) {
+                $arguments[$i] = "$prefix{$arguments[$i]}";
+            }
 
-        $command->setRawArguments($arguments);
+            $command->setRawArguments($arguments);
+        }
     }
 }

+ 1 - 1
lib/Predis/Command/Processor/KeyPrefixProcessor.php

@@ -57,7 +57,7 @@ class KeyPrefixProcessor implements CommandProcessorInterface
      */
     public function process(CommandInterface $command)
     {
-        if ($command instanceof PrefixableCommandInterface) {
+        if ($command instanceof PrefixableCommandInterface && $command->getArguments()) {
             $command->prefixKeys($this->prefix);
         }
     }

+ 5 - 5
lib/Predis/Command/ServerEval.php

@@ -30,13 +30,13 @@ class ServerEval extends AbstractCommand implements PrefixableCommandInterface
      */
     public function prefixKeys($prefix)
     {
-        $arguments = $this->getArguments();
+        if ($arguments = $this->getArguments()) {
+            for ($i = 2; $i < $arguments[1] + 2; $i++) {
+                $arguments[$i] = "$prefix{$arguments[$i]}";
+            }
 
-        for ($i = 2; $i < $arguments[1] + 2; $i++) {
-            $arguments[$i] = "$prefix{$arguments[$i]}";
+            $this->setRawArguments($arguments);
         }
-
-        $this->setRawArguments($arguments);
     }
 
     /**

+ 7 - 7
lib/Predis/Command/ZSetUnionStore.php

@@ -79,15 +79,15 @@ class ZSetUnionStore extends PrefixableCommand
      */
     public function prefixKeys($prefix)
     {
-        $arguments = $this->getArguments();
+        if ($arguments = $this->getArguments()) {
+            $arguments[0] = "$prefix{$arguments[0]}";
+            $length = ((int) $arguments[1]) + 2;
 
-        $arguments[0] = "$prefix{$arguments[0]}";
-        $length = ((int) $arguments[1]) + 2;
+            for ($i = 2; $i < $length; $i++) {
+                $arguments[$i] = "$prefix{$arguments[$i]}";
+            }
 
-        for ($i = 2; $i < $length; $i++) {
-            $arguments[$i] = "$prefix{$arguments[$i]}";
+            $this->setRawArguments($arguments);
         }
-
-        $this->setRawArguments($arguments);
     }
 }

+ 11 - 0
tests/Predis/Command/HashDeleteTest.php

@@ -85,6 +85,17 @@ class HashDeleteTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/HashExistsTest.php

@@ -74,6 +74,17 @@ class HashExistsTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/HashGetAllTest.php

@@ -76,6 +76,17 @@ class HashGetAllTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/HashGetMultipleTest.php

@@ -90,6 +90,17 @@ class HashGetMultipleTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/HashGetTest.php

@@ -71,6 +71,17 @@ class HashGetTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/HashIncrementByFloatTest.php

@@ -71,6 +71,17 @@ class HashIncrementByFloatTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/HashIncrementByTest.php

@@ -71,6 +71,17 @@ class HashIncrementByTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/HashKeysTest.php

@@ -76,6 +76,17 @@ class HashKeysTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/HashLengthTest.php

@@ -71,6 +71,17 @@ class HashLengthTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/HashSetMultipleTest.php

@@ -85,6 +85,17 @@ class HashSetMultipleTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/HashSetPreserveTest.php

@@ -74,6 +74,17 @@ class HashSetPreserveTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/HashSetTest.php

@@ -74,6 +74,17 @@ class HashSetTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/HashValuesTest.php

@@ -76,6 +76,17 @@ class HashValuesTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/KeyDeleteTest.php

@@ -86,6 +86,17 @@ class KeyDeleteTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/KeyDumpTest.php

@@ -75,4 +75,15 @@ class KeyDumpTest extends CommandTestCase
 
         $this->assertSame($expected, $command->getArguments());
     }
+
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
 }

+ 11 - 0
tests/Predis/Command/KeyExistsTest.php

@@ -74,6 +74,17 @@ class KeyExistsTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/KeyExpireAtTest.php

@@ -74,6 +74,17 @@ class KeyExpireAtTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/KeyExpireTest.php

@@ -74,6 +74,17 @@ class KeyExpireTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/KeyKeysTest.php

@@ -74,6 +74,17 @@ class KeyKeysTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/KeyKeysV12xTest.php

@@ -77,4 +77,15 @@ class KeyKeysV12xTest extends CommandTestCase
 
         $this->assertSame($expected, $command->getArguments());
     }
+
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
 }

+ 11 - 0
tests/Predis/Command/KeyMoveTest.php

@@ -74,6 +74,17 @@ class KeyMoveTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      * @todo This test fails if REDIS_SERVER_DBNUM is 0.

+ 11 - 0
tests/Predis/Command/KeyPersistTest.php

@@ -74,6 +74,17 @@ class KeyPersistTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/KeyPreciseExpireAtTest.php

@@ -74,6 +74,17 @@ class KeyPreciseExpireAtTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      * @group slow

+ 11 - 0
tests/Predis/Command/KeyPreciseExpireTest.php

@@ -74,6 +74,17 @@ class KeyPreciseExpireTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/KeyPreciseTimeToLiveTest.php

@@ -73,6 +73,17 @@ class KeyPreciseTimeToLiveTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/KeyRenamePreserveTest.php

@@ -72,6 +72,17 @@ class KeyRenamePreserveTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/KeyRenameTest.php

@@ -71,6 +71,17 @@ class KeyRenameTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/KeyRestoreTest.php

@@ -70,4 +70,15 @@ class KeyRestoreTest extends CommandTestCase
 
         $this->assertSame($expected, $command->getArguments());
     }
+
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
 }

+ 11 - 0
tests/Predis/Command/KeySortTest.php

@@ -129,6 +129,17 @@ class KeySortTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/KeyTimeToLiveTest.php

@@ -73,6 +73,17 @@ class KeyTimeToLiveTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/KeyTypeTest.php

@@ -71,6 +71,17 @@ class KeyTypeTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/ListIndexTest.php

@@ -71,6 +71,17 @@ class ListIndexTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/ListInsertTest.php

@@ -71,6 +71,17 @@ class ListInsertTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/ListLengthTest.php

@@ -71,6 +71,17 @@ class ListLengthTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/ListPopFirstBlockingTest.php

@@ -91,4 +91,15 @@ class ListPopFirstBlockingTest extends CommandTestCase
 
         $this->assertSame($expected, $command->getArguments());
     }
+
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
 }

+ 11 - 0
tests/Predis/Command/ListPopFirstTest.php

@@ -71,6 +71,17 @@ class ListPopFirstTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/ListPopLastBlockingTest.php

@@ -91,4 +91,15 @@ class ListPopLastBlockingTest extends CommandTestCase
 
         $this->assertSame($expected, $command->getArguments());
     }
+
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
 }

+ 11 - 0
tests/Predis/Command/ListPopLastPushHeadBlockingTest.php

@@ -72,4 +72,15 @@ class ListPopLastPushHeadBlockingTest extends CommandTestCase
 
         $this->assertSame($expected, $command->getArguments());
     }
+
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
 }

+ 11 - 0
tests/Predis/Command/ListPopLastPushHeadTest.php

@@ -71,6 +71,17 @@ class ListPopLastPushHeadTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/ListPopLastTest.php

@@ -71,6 +71,17 @@ class ListPopLastTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/ListPushHeadTest.php

@@ -85,6 +85,17 @@ class ListPushHeadTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/ListPushHeadXTest.php

@@ -71,6 +71,17 @@ class ListPushHeadXTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/ListPushTailTest.php

@@ -85,6 +85,17 @@ class ListPushTailTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/ListPushTailXTest.php

@@ -71,6 +71,17 @@ class ListPushTailXTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/ListRangeTest.php

@@ -76,6 +76,17 @@ class ListRangeTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/ListRemoveTest.php

@@ -71,6 +71,17 @@ class ListRemoveTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/ListSetTest.php

@@ -71,6 +71,17 @@ class ListSetTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/ListTrimTest.php

@@ -71,6 +71,17 @@ class ListTrimTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 20 - 3
tests/Predis/Command/Processor/KeyPrefixProcessorTest.php

@@ -51,13 +51,30 @@ class KeyPrefixProcessorTest extends StandardTestCase
     public function testProcessPrefixableCommands()
     {
         $prefix = 'prefix:';
-        $unprefixed = 'key';
-        $expected = "$prefix$unprefixed";
 
         $command = $this->getMock('Predis\Command\PrefixableCommand');
         $command->expects($this->once())
                 ->method('prefixKeys')
                 ->with($prefix);
+        $command->expects($this->once())
+                ->method('getArguments')
+                ->will($this->returnValue('key'));
+
+        $processor = new KeyPrefixProcessor($prefix);
+
+        $processor->process($command);
+    }
+
+    /**
+     * @group disconnected
+     */
+    public function testSkipPrefixableCommandsWithNoArguments()
+    {
+        $prefix = 'prefix:';
+
+        $command = $this->getMock('Predis\Command\PrefixableCommand');
+        $command->expects($this->never())
+                ->method('prefixKeys');
 
         $processor = new KeyPrefixProcessor($prefix);
 
@@ -67,7 +84,7 @@ class KeyPrefixProcessorTest extends StandardTestCase
     /**
      * @group disconnected
      */
-    public function testProcessNotPrefixableCommands()
+    public function testSkipNotPrefixableCommands()
     {
         $prefix = 'prefix:';
         $unprefixed = 'key';

+ 11 - 0
tests/Predis/Command/PubSubPublishTest.php

@@ -71,6 +71,17 @@ class PubSubPublishTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/PubSubSubscribeByPatternTest.php

@@ -90,6 +90,17 @@ class PubSubSubscribeByPatternTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/PubSubSubscribeTest.php

@@ -90,6 +90,17 @@ class PubSubSubscribeTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/PubSubUnsubscribeByPatternTest.php

@@ -90,6 +90,17 @@ class PubSubUnsubscribeByPatternTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/PubSubUnsubscribeTest.php

@@ -90,6 +90,17 @@ class PubSubUnsubscribeTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/ServerEvalSHATest.php

@@ -75,6 +75,17 @@ class ServerEvalSHATest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group disconnected
      */

+ 11 - 0
tests/Predis/Command/ServerEvalTest.php

@@ -75,6 +75,17 @@ class ServerEvalTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group disconnected
      */

+ 11 - 0
tests/Predis/Command/SetAddTest.php

@@ -85,6 +85,17 @@ class SetAddTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/SetCardinalityTest.php

@@ -71,6 +71,17 @@ class SetCardinalityTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/SetDifferenceStoreTest.php

@@ -85,6 +85,17 @@ class SetDifferenceStoreTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/SetDifferenceTest.php

@@ -90,6 +90,17 @@ class SetDifferenceTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/SetIntersectionStoreTest.php

@@ -85,6 +85,17 @@ class SetIntersectionStoreTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/SetIntersectionTest.php

@@ -90,6 +90,17 @@ class SetIntersectionTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/SetIsMemberTest.php

@@ -74,6 +74,17 @@ class SetIsMemberTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/SetMembersTest.php

@@ -76,6 +76,17 @@ class SetMembersTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/SetMoveTest.php

@@ -74,6 +74,17 @@ class SetMoveTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/SetPopTest.php

@@ -71,6 +71,17 @@ class SetPopTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/SetRandomMemberTest.php

@@ -71,6 +71,17 @@ class SetRandomMemberTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/SetRemoveTest.php

@@ -85,6 +85,17 @@ class SetRemoveTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/SetUnionStoreTest.php

@@ -85,6 +85,17 @@ class SetUnionStoreTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/SetUnionTest.php

@@ -90,6 +90,17 @@ class SetUnionTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/StringAppendTest.php

@@ -71,6 +71,17 @@ class StringAppendTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/StringBitCountTest.php

@@ -76,6 +76,17 @@ class StringBitCountTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/StringBitOpTest.php

@@ -90,6 +90,17 @@ class StringBitOpTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/StringDecrementByTest.php

@@ -71,6 +71,17 @@ class StringDecrementByTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/StringDecrementTest.php

@@ -71,6 +71,17 @@ class StringDecrementTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/StringGetBitTest.php

@@ -73,6 +73,17 @@ class StringGetBitTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 10 - 0
tests/Predis/Command/StringGetMultipleTest.php

@@ -90,6 +90,16 @@ class StringGetMultipleTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
 
     /**
      * @group connected

+ 11 - 0
tests/Predis/Command/StringGetRangeTest.php

@@ -71,6 +71,17 @@ class StringGetRangeTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/StringGetSetTest.php

@@ -71,6 +71,17 @@ class StringGetSetTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/StringGetTest.php

@@ -71,6 +71,17 @@ class StringGetTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/StringIncrementByFloatTest.php

@@ -71,6 +71,17 @@ class StringIncrementByFloatTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/StringIncrementByTest.php

@@ -71,6 +71,17 @@ class StringIncrementByTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/StringIncrementTest.php

@@ -71,6 +71,17 @@ class StringIncrementTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/StringPreciseSetExpireTest.php

@@ -71,6 +71,17 @@ class StringPreciseSetExpireTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/StringSetBitTest.php

@@ -73,6 +73,17 @@ class StringSetBitTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/StringSetExpireTest.php

@@ -71,6 +71,17 @@ class StringSetExpireTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/StringSetMultiplePreserveTest.php

@@ -85,6 +85,17 @@ class StringSetMultiplePreserveTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/StringSetMultipleTest.php

@@ -85,6 +85,17 @@ class StringSetMultipleTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/StringSetRangeTest.php

@@ -71,6 +71,17 @@ class StringSetRangeTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/StringSetTest.php

@@ -71,6 +71,17 @@ class StringSetTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/StringStrlenTest.php

@@ -71,6 +71,17 @@ class StringStrlenTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

+ 11 - 0
tests/Predis/Command/StringSubstrTest.php

@@ -74,4 +74,15 @@ class StringSubstrTest extends CommandTestCase
 
         $this->assertSame($expected, $command->getArguments());
     }
+
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
 }

+ 11 - 0
tests/Predis/Command/TransactionWatchTest.php

@@ -85,6 +85,17 @@ class TransactionWatchTest extends CommandTestCase
         $this->assertSame($expected, $command->getArguments());
     }
 
+    /**
+     * @group disconnected
+     */
+    public function testPrefixKeysIgnoredOnEmptyArguments()
+    {
+        $command = $this->getCommand();
+        $command->prefixKeys('prefix:');
+
+        $this->assertSame(array(), $command->getArguments());
+    }
+
     /**
      * @group connected
      */

Some files were not shown because too many files changed in this diff