From 6e2fd181f125acaaeddf53da90b96d71f38c95c0 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Sat, 16 Mar 2013 16:00:33 +0100 Subject: [PATCH] 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. --- CHANGELOG.md | 3 ++ bin/generate-command-test.php | 11 +++++ lib/Predis/Command/KeySort.php | 41 ++++++++-------- lib/Predis/Command/PrefixHelpers.php | 49 ++++++++++--------- .../Command/Processor/KeyPrefixProcessor.php | 2 +- lib/Predis/Command/ServerEval.php | 10 ++-- lib/Predis/Command/ZSetUnionStore.php | 14 +++--- tests/Predis/Command/HashDeleteTest.php | 11 +++++ tests/Predis/Command/HashExistsTest.php | 11 +++++ tests/Predis/Command/HashGetAllTest.php | 11 +++++ tests/Predis/Command/HashGetMultipleTest.php | 11 +++++ tests/Predis/Command/HashGetTest.php | 11 +++++ .../Command/HashIncrementByFloatTest.php | 11 +++++ tests/Predis/Command/HashIncrementByTest.php | 11 +++++ tests/Predis/Command/HashKeysTest.php | 11 +++++ tests/Predis/Command/HashLengthTest.php | 11 +++++ tests/Predis/Command/HashSetMultipleTest.php | 11 +++++ tests/Predis/Command/HashSetPreserveTest.php | 11 +++++ tests/Predis/Command/HashSetTest.php | 11 +++++ tests/Predis/Command/HashValuesTest.php | 11 +++++ tests/Predis/Command/KeyDeleteTest.php | 11 +++++ tests/Predis/Command/KeyDumpTest.php | 11 +++++ tests/Predis/Command/KeyExistsTest.php | 11 +++++ tests/Predis/Command/KeyExpireAtTest.php | 11 +++++ tests/Predis/Command/KeyExpireTest.php | 11 +++++ tests/Predis/Command/KeyKeysTest.php | 11 +++++ tests/Predis/Command/KeyKeysV12xTest.php | 11 +++++ tests/Predis/Command/KeyMoveTest.php | 11 +++++ tests/Predis/Command/KeyPersistTest.php | 11 +++++ .../Predis/Command/KeyPreciseExpireAtTest.php | 11 +++++ tests/Predis/Command/KeyPreciseExpireTest.php | 11 +++++ .../Command/KeyPreciseTimeToLiveTest.php | 11 +++++ .../Predis/Command/KeyRenamePreserveTest.php | 11 +++++ tests/Predis/Command/KeyRenameTest.php | 11 +++++ tests/Predis/Command/KeyRestoreTest.php | 11 +++++ tests/Predis/Command/KeySortTest.php | 11 +++++ tests/Predis/Command/KeyTimeToLiveTest.php | 11 +++++ tests/Predis/Command/KeyTypeTest.php | 11 +++++ tests/Predis/Command/ListIndexTest.php | 11 +++++ tests/Predis/Command/ListInsertTest.php | 11 +++++ tests/Predis/Command/ListLengthTest.php | 11 +++++ .../Command/ListPopFirstBlockingTest.php | 11 +++++ tests/Predis/Command/ListPopFirstTest.php | 11 +++++ .../Command/ListPopLastBlockingTest.php | 11 +++++ .../ListPopLastPushHeadBlockingTest.php | 11 +++++ .../Command/ListPopLastPushHeadTest.php | 11 +++++ tests/Predis/Command/ListPopLastTest.php | 11 +++++ tests/Predis/Command/ListPushHeadTest.php | 11 +++++ tests/Predis/Command/ListPushHeadXTest.php | 11 +++++ tests/Predis/Command/ListPushTailTest.php | 11 +++++ tests/Predis/Command/ListPushTailXTest.php | 11 +++++ tests/Predis/Command/ListRangeTest.php | 11 +++++ tests/Predis/Command/ListRemoveTest.php | 11 +++++ tests/Predis/Command/ListSetTest.php | 11 +++++ tests/Predis/Command/ListTrimTest.php | 11 +++++ .../Processor/KeyPrefixProcessorTest.php | 23 +++++++-- tests/Predis/Command/PubSubPublishTest.php | 11 +++++ .../Command/PubSubSubscribeByPatternTest.php | 11 +++++ tests/Predis/Command/PubSubSubscribeTest.php | 11 +++++ .../PubSubUnsubscribeByPatternTest.php | 11 +++++ .../Predis/Command/PubSubUnsubscribeTest.php | 11 +++++ tests/Predis/Command/ServerEvalSHATest.php | 11 +++++ tests/Predis/Command/ServerEvalTest.php | 11 +++++ tests/Predis/Command/SetAddTest.php | 11 +++++ tests/Predis/Command/SetCardinalityTest.php | 11 +++++ .../Predis/Command/SetDifferenceStoreTest.php | 11 +++++ tests/Predis/Command/SetDifferenceTest.php | 11 +++++ .../Command/SetIntersectionStoreTest.php | 11 +++++ tests/Predis/Command/SetIntersectionTest.php | 11 +++++ tests/Predis/Command/SetIsMemberTest.php | 11 +++++ tests/Predis/Command/SetMembersTest.php | 11 +++++ tests/Predis/Command/SetMoveTest.php | 11 +++++ tests/Predis/Command/SetPopTest.php | 11 +++++ tests/Predis/Command/SetRandomMemberTest.php | 11 +++++ tests/Predis/Command/SetRemoveTest.php | 11 +++++ tests/Predis/Command/SetUnionStoreTest.php | 11 +++++ tests/Predis/Command/SetUnionTest.php | 11 +++++ tests/Predis/Command/StringAppendTest.php | 11 +++++ tests/Predis/Command/StringBitCountTest.php | 11 +++++ tests/Predis/Command/StringBitOpTest.php | 11 +++++ .../Predis/Command/StringDecrementByTest.php | 11 +++++ tests/Predis/Command/StringDecrementTest.php | 11 +++++ tests/Predis/Command/StringGetBitTest.php | 11 +++++ .../Predis/Command/StringGetMultipleTest.php | 10 ++++ tests/Predis/Command/StringGetRangeTest.php | 11 +++++ tests/Predis/Command/StringGetSetTest.php | 11 +++++ tests/Predis/Command/StringGetTest.php | 11 +++++ .../Command/StringIncrementByFloatTest.php | 11 +++++ .../Predis/Command/StringIncrementByTest.php | 11 +++++ tests/Predis/Command/StringIncrementTest.php | 11 +++++ .../Command/StringPreciseSetExpireTest.php | 11 +++++ tests/Predis/Command/StringSetBitTest.php | 11 +++++ tests/Predis/Command/StringSetExpireTest.php | 11 +++++ .../Command/StringSetMultiplePreserveTest.php | 11 +++++ .../Predis/Command/StringSetMultipleTest.php | 11 +++++ tests/Predis/Command/StringSetRangeTest.php | 11 +++++ tests/Predis/Command/StringSetTest.php | 11 +++++ tests/Predis/Command/StringStrlenTest.php | 11 +++++ tests/Predis/Command/StringSubstrTest.php | 11 +++++ tests/Predis/Command/TransactionWatchTest.php | 11 +++++ tests/Predis/Command/ZSetAddTest.php | 11 +++++ tests/Predis/Command/ZSetCardinalityTest.php | 11 +++++ tests/Predis/Command/ZSetCountTest.php | 11 +++++ tests/Predis/Command/ZSetIncrementByTest.php | 11 +++++ .../Command/ZSetIntersectionStoreTest.php | 11 +++++ tests/Predis/Command/ZSetRangeByScoreTest.php | 11 +++++ tests/Predis/Command/ZSetRangeTest.php | 11 +++++ tests/Predis/Command/ZSetRankTest.php | 11 +++++ .../Command/ZSetRemoveRangeByRankTest.php | 11 +++++ .../Command/ZSetRemoveRangeByScoreTest.php | 11 +++++ tests/Predis/Command/ZSetRemoveTest.php | 11 +++++ .../Command/ZSetReverseRangeByScoreTest.php | 11 +++++ tests/Predis/Command/ZSetReverseRangeTest.php | 11 +++++ tests/Predis/Command/ZSetReverseRankTest.php | 11 +++++ tests/Predis/Command/ZSetScoreTest.php | 11 +++++ tests/Predis/Command/ZSetUnionStoreTest.php | 11 +++++ 116 files changed, 1281 insertions(+), 59 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 507c910c..cbcc3fe8 100644 --- a/CHANGELOG.md +++ b/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) =============================================================================== diff --git a/bin/generate-command-test.php b/bin/generate-command-test.php index 3631aeec..51ccde3e 100755 --- a/bin/generate-command-test.php +++ b/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; } diff --git a/lib/Predis/Command/KeySort.php b/lib/Predis/Command/KeySort.php index 0defd7ed..549469a8 100644 --- a/lib/Predis/Command/KeySort.php +++ b/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 ($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; + 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 'GET': + $value = $arguments[++$i]; + if ($value !== '#') { + $arguments[$i] = "$prefix$value"; + } + break; - case 'LIMIT'; - $i += 2; - break; + case 'LIMIT'; + $i += 2; + break; + } } } - } - $this->setRawArguments($arguments); + $this->setRawArguments($arguments); + } } } diff --git a/lib/Predis/Command/PrefixHelpers.php b/lib/Predis/Command/PrefixHelpers.php index 5cd62839..0c37d6f8 100644 --- a/lib/Predis/Command/PrefixHelpers.php +++ b/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); } } diff --git a/lib/Predis/Command/Processor/KeyPrefixProcessor.php b/lib/Predis/Command/Processor/KeyPrefixProcessor.php index 477639ff..ed0d17fa 100644 --- a/lib/Predis/Command/Processor/KeyPrefixProcessor.php +++ b/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); } } diff --git a/lib/Predis/Command/ServerEval.php b/lib/Predis/Command/ServerEval.php index 098fa29c..0c1f1828 100644 --- a/lib/Predis/Command/ServerEval.php +++ b/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); } /** diff --git a/lib/Predis/Command/ZSetUnionStore.php b/lib/Predis/Command/ZSetUnionStore.php index 0df8959d..ba971766 100644 --- a/lib/Predis/Command/ZSetUnionStore.php +++ b/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); } } diff --git a/tests/Predis/Command/HashDeleteTest.php b/tests/Predis/Command/HashDeleteTest.php index 64460e48..adb7c2bf 100644 --- a/tests/Predis/Command/HashDeleteTest.php +++ b/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 */ diff --git a/tests/Predis/Command/HashExistsTest.php b/tests/Predis/Command/HashExistsTest.php index ac4ffb3d..7b27b722 100644 --- a/tests/Predis/Command/HashExistsTest.php +++ b/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 */ diff --git a/tests/Predis/Command/HashGetAllTest.php b/tests/Predis/Command/HashGetAllTest.php index ec0d2d1c..36c5c79e 100644 --- a/tests/Predis/Command/HashGetAllTest.php +++ b/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 */ diff --git a/tests/Predis/Command/HashGetMultipleTest.php b/tests/Predis/Command/HashGetMultipleTest.php index 8aec4995..4cabd2b4 100644 --- a/tests/Predis/Command/HashGetMultipleTest.php +++ b/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 */ diff --git a/tests/Predis/Command/HashGetTest.php b/tests/Predis/Command/HashGetTest.php index c159fe69..b68067b6 100644 --- a/tests/Predis/Command/HashGetTest.php +++ b/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 */ diff --git a/tests/Predis/Command/HashIncrementByFloatTest.php b/tests/Predis/Command/HashIncrementByFloatTest.php index eb3944ae..286ebc5c 100644 --- a/tests/Predis/Command/HashIncrementByFloatTest.php +++ b/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 */ diff --git a/tests/Predis/Command/HashIncrementByTest.php b/tests/Predis/Command/HashIncrementByTest.php index 33ebfaf6..2cf2bbff 100644 --- a/tests/Predis/Command/HashIncrementByTest.php +++ b/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 */ diff --git a/tests/Predis/Command/HashKeysTest.php b/tests/Predis/Command/HashKeysTest.php index f998564d..04c0a2d3 100644 --- a/tests/Predis/Command/HashKeysTest.php +++ b/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 */ diff --git a/tests/Predis/Command/HashLengthTest.php b/tests/Predis/Command/HashLengthTest.php index 97fd0319..9c950b65 100644 --- a/tests/Predis/Command/HashLengthTest.php +++ b/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 */ diff --git a/tests/Predis/Command/HashSetMultipleTest.php b/tests/Predis/Command/HashSetMultipleTest.php index a6376490..5f9a1ef9 100644 --- a/tests/Predis/Command/HashSetMultipleTest.php +++ b/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 */ diff --git a/tests/Predis/Command/HashSetPreserveTest.php b/tests/Predis/Command/HashSetPreserveTest.php index c589d533..ca1b35d8 100644 --- a/tests/Predis/Command/HashSetPreserveTest.php +++ b/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 */ diff --git a/tests/Predis/Command/HashSetTest.php b/tests/Predis/Command/HashSetTest.php index 8d25bbfa..fee08e47 100644 --- a/tests/Predis/Command/HashSetTest.php +++ b/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 */ diff --git a/tests/Predis/Command/HashValuesTest.php b/tests/Predis/Command/HashValuesTest.php index 55389138..6cedd8ed 100644 --- a/tests/Predis/Command/HashValuesTest.php +++ b/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 */ diff --git a/tests/Predis/Command/KeyDeleteTest.php b/tests/Predis/Command/KeyDeleteTest.php index 5a045c53..f6e9154c 100644 --- a/tests/Predis/Command/KeyDeleteTest.php +++ b/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 */ diff --git a/tests/Predis/Command/KeyDumpTest.php b/tests/Predis/Command/KeyDumpTest.php index bca724c7..621ffff7 100644 --- a/tests/Predis/Command/KeyDumpTest.php +++ b/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()); + } } diff --git a/tests/Predis/Command/KeyExistsTest.php b/tests/Predis/Command/KeyExistsTest.php index a87214f4..581dc25b 100644 --- a/tests/Predis/Command/KeyExistsTest.php +++ b/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 */ diff --git a/tests/Predis/Command/KeyExpireAtTest.php b/tests/Predis/Command/KeyExpireAtTest.php index e0a81b4e..0f217538 100644 --- a/tests/Predis/Command/KeyExpireAtTest.php +++ b/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 */ diff --git a/tests/Predis/Command/KeyExpireTest.php b/tests/Predis/Command/KeyExpireTest.php index 5b704bd9..b070393c 100644 --- a/tests/Predis/Command/KeyExpireTest.php +++ b/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 */ diff --git a/tests/Predis/Command/KeyKeysTest.php b/tests/Predis/Command/KeyKeysTest.php index 7f1113b5..0bed0fef 100644 --- a/tests/Predis/Command/KeyKeysTest.php +++ b/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 */ diff --git a/tests/Predis/Command/KeyKeysV12xTest.php b/tests/Predis/Command/KeyKeysV12xTest.php index 84b44a8a..10ebb187 100644 --- a/tests/Predis/Command/KeyKeysV12xTest.php +++ b/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()); + } } diff --git a/tests/Predis/Command/KeyMoveTest.php b/tests/Predis/Command/KeyMoveTest.php index ec9502e6..d1839329 100644 --- a/tests/Predis/Command/KeyMoveTest.php +++ b/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. diff --git a/tests/Predis/Command/KeyPersistTest.php b/tests/Predis/Command/KeyPersistTest.php index bf9a3252..090a8986 100644 --- a/tests/Predis/Command/KeyPersistTest.php +++ b/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 */ diff --git a/tests/Predis/Command/KeyPreciseExpireAtTest.php b/tests/Predis/Command/KeyPreciseExpireAtTest.php index 72bc7b71..90ab9f18 100644 --- a/tests/Predis/Command/KeyPreciseExpireAtTest.php +++ b/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 diff --git a/tests/Predis/Command/KeyPreciseExpireTest.php b/tests/Predis/Command/KeyPreciseExpireTest.php index d118998f..15f3f4a0 100644 --- a/tests/Predis/Command/KeyPreciseExpireTest.php +++ b/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 */ diff --git a/tests/Predis/Command/KeyPreciseTimeToLiveTest.php b/tests/Predis/Command/KeyPreciseTimeToLiveTest.php index c6a64058..4b9266da 100644 --- a/tests/Predis/Command/KeyPreciseTimeToLiveTest.php +++ b/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 */ diff --git a/tests/Predis/Command/KeyRenamePreserveTest.php b/tests/Predis/Command/KeyRenamePreserveTest.php index f469bcf5..d467ff7c 100644 --- a/tests/Predis/Command/KeyRenamePreserveTest.php +++ b/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 */ diff --git a/tests/Predis/Command/KeyRenameTest.php b/tests/Predis/Command/KeyRenameTest.php index dd79e348..e899d3b5 100644 --- a/tests/Predis/Command/KeyRenameTest.php +++ b/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 */ diff --git a/tests/Predis/Command/KeyRestoreTest.php b/tests/Predis/Command/KeyRestoreTest.php index e3960838..4bd1582e 100644 --- a/tests/Predis/Command/KeyRestoreTest.php +++ b/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()); + } } diff --git a/tests/Predis/Command/KeySortTest.php b/tests/Predis/Command/KeySortTest.php index 07ff466d..8f6ac6f5 100644 --- a/tests/Predis/Command/KeySortTest.php +++ b/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 */ diff --git a/tests/Predis/Command/KeyTimeToLiveTest.php b/tests/Predis/Command/KeyTimeToLiveTest.php index c3f83eee..440cf1f3 100644 --- a/tests/Predis/Command/KeyTimeToLiveTest.php +++ b/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 */ diff --git a/tests/Predis/Command/KeyTypeTest.php b/tests/Predis/Command/KeyTypeTest.php index d5e7fccf..81d32b4e 100644 --- a/tests/Predis/Command/KeyTypeTest.php +++ b/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 */ diff --git a/tests/Predis/Command/ListIndexTest.php b/tests/Predis/Command/ListIndexTest.php index 8383eb8a..3de7e751 100644 --- a/tests/Predis/Command/ListIndexTest.php +++ b/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 */ diff --git a/tests/Predis/Command/ListInsertTest.php b/tests/Predis/Command/ListInsertTest.php index 31578b90..2fd3c7e1 100644 --- a/tests/Predis/Command/ListInsertTest.php +++ b/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 */ diff --git a/tests/Predis/Command/ListLengthTest.php b/tests/Predis/Command/ListLengthTest.php index 2e2a0384..b36e7478 100644 --- a/tests/Predis/Command/ListLengthTest.php +++ b/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 */ diff --git a/tests/Predis/Command/ListPopFirstBlockingTest.php b/tests/Predis/Command/ListPopFirstBlockingTest.php index c9ffcfaa..080f82e7 100644 --- a/tests/Predis/Command/ListPopFirstBlockingTest.php +++ b/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()); + } } diff --git a/tests/Predis/Command/ListPopFirstTest.php b/tests/Predis/Command/ListPopFirstTest.php index 4e148c8a..c7a60069 100644 --- a/tests/Predis/Command/ListPopFirstTest.php +++ b/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 */ diff --git a/tests/Predis/Command/ListPopLastBlockingTest.php b/tests/Predis/Command/ListPopLastBlockingTest.php index 7b1710a0..63b3316b 100644 --- a/tests/Predis/Command/ListPopLastBlockingTest.php +++ b/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()); + } } diff --git a/tests/Predis/Command/ListPopLastPushHeadBlockingTest.php b/tests/Predis/Command/ListPopLastPushHeadBlockingTest.php index 56aebd31..ce2f5b7e 100644 --- a/tests/Predis/Command/ListPopLastPushHeadBlockingTest.php +++ b/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()); + } } diff --git a/tests/Predis/Command/ListPopLastPushHeadTest.php b/tests/Predis/Command/ListPopLastPushHeadTest.php index 3b5dd929..0df30cc5 100644 --- a/tests/Predis/Command/ListPopLastPushHeadTest.php +++ b/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 */ diff --git a/tests/Predis/Command/ListPopLastTest.php b/tests/Predis/Command/ListPopLastTest.php index 0655d8de..3a66d3e2 100644 --- a/tests/Predis/Command/ListPopLastTest.php +++ b/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 */ diff --git a/tests/Predis/Command/ListPushHeadTest.php b/tests/Predis/Command/ListPushHeadTest.php index af5a37e9..685bca2d 100644 --- a/tests/Predis/Command/ListPushHeadTest.php +++ b/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 */ diff --git a/tests/Predis/Command/ListPushHeadXTest.php b/tests/Predis/Command/ListPushHeadXTest.php index 73ae6a18..67d9bdf1 100644 --- a/tests/Predis/Command/ListPushHeadXTest.php +++ b/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 */ diff --git a/tests/Predis/Command/ListPushTailTest.php b/tests/Predis/Command/ListPushTailTest.php index 4460b237..8f69bb03 100644 --- a/tests/Predis/Command/ListPushTailTest.php +++ b/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 */ diff --git a/tests/Predis/Command/ListPushTailXTest.php b/tests/Predis/Command/ListPushTailXTest.php index 48f2e573..4175de5c 100644 --- a/tests/Predis/Command/ListPushTailXTest.php +++ b/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 */ diff --git a/tests/Predis/Command/ListRangeTest.php b/tests/Predis/Command/ListRangeTest.php index 654cfc49..ea6f5ef9 100644 --- a/tests/Predis/Command/ListRangeTest.php +++ b/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 */ diff --git a/tests/Predis/Command/ListRemoveTest.php b/tests/Predis/Command/ListRemoveTest.php index ae0adf2a..32e23cb3 100644 --- a/tests/Predis/Command/ListRemoveTest.php +++ b/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 */ diff --git a/tests/Predis/Command/ListSetTest.php b/tests/Predis/Command/ListSetTest.php index bddc6be1..124109d9 100644 --- a/tests/Predis/Command/ListSetTest.php +++ b/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 */ diff --git a/tests/Predis/Command/ListTrimTest.php b/tests/Predis/Command/ListTrimTest.php index 7970c7f2..b543a630 100644 --- a/tests/Predis/Command/ListTrimTest.php +++ b/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 */ diff --git a/tests/Predis/Command/Processor/KeyPrefixProcessorTest.php b/tests/Predis/Command/Processor/KeyPrefixProcessorTest.php index 906d7cb7..16f31946 100644 --- a/tests/Predis/Command/Processor/KeyPrefixProcessorTest.php +++ b/tests/Predis/Command/Processor/KeyPrefixProcessorTest.php @@ -51,13 +51,14 @@ 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); @@ -67,7 +68,23 @@ class KeyPrefixProcessorTest extends StandardTestCase /** * @group disconnected */ - public function testProcessNotPrefixableCommands() + public function testSkipPrefixableCommandsWithNoArguments() + { + $prefix = 'prefix:'; + + $command = $this->getMock('Predis\Command\PrefixableCommand'); + $command->expects($this->never()) + ->method('prefixKeys'); + + $processor = new KeyPrefixProcessor($prefix); + + $processor->process($command); + } + + /** + * @group disconnected + */ + public function testSkipNotPrefixableCommands() { $prefix = 'prefix:'; $unprefixed = 'key'; diff --git a/tests/Predis/Command/PubSubPublishTest.php b/tests/Predis/Command/PubSubPublishTest.php index 55bd3dcb..69d3f595 100644 --- a/tests/Predis/Command/PubSubPublishTest.php +++ b/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 */ diff --git a/tests/Predis/Command/PubSubSubscribeByPatternTest.php b/tests/Predis/Command/PubSubSubscribeByPatternTest.php index 2f68b868..94c1a8e6 100644 --- a/tests/Predis/Command/PubSubSubscribeByPatternTest.php +++ b/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 */ diff --git a/tests/Predis/Command/PubSubSubscribeTest.php b/tests/Predis/Command/PubSubSubscribeTest.php index 01e5a0f6..3c424d49 100644 --- a/tests/Predis/Command/PubSubSubscribeTest.php +++ b/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 */ diff --git a/tests/Predis/Command/PubSubUnsubscribeByPatternTest.php b/tests/Predis/Command/PubSubUnsubscribeByPatternTest.php index 3142d9f8..4a1be3a7 100644 --- a/tests/Predis/Command/PubSubUnsubscribeByPatternTest.php +++ b/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 */ diff --git a/tests/Predis/Command/PubSubUnsubscribeTest.php b/tests/Predis/Command/PubSubUnsubscribeTest.php index d57586ff..b2fd6415 100644 --- a/tests/Predis/Command/PubSubUnsubscribeTest.php +++ b/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 */ diff --git a/tests/Predis/Command/ServerEvalSHATest.php b/tests/Predis/Command/ServerEvalSHATest.php index 12ae5c4c..d777db0c 100644 --- a/tests/Predis/Command/ServerEvalSHATest.php +++ b/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 */ diff --git a/tests/Predis/Command/ServerEvalTest.php b/tests/Predis/Command/ServerEvalTest.php index 11df8fb9..5aebf6ee 100644 --- a/tests/Predis/Command/ServerEvalTest.php +++ b/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 */ diff --git a/tests/Predis/Command/SetAddTest.php b/tests/Predis/Command/SetAddTest.php index 0b709aac..6452cb9a 100644 --- a/tests/Predis/Command/SetAddTest.php +++ b/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 */ diff --git a/tests/Predis/Command/SetCardinalityTest.php b/tests/Predis/Command/SetCardinalityTest.php index 4112d623..5a806263 100644 --- a/tests/Predis/Command/SetCardinalityTest.php +++ b/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 */ diff --git a/tests/Predis/Command/SetDifferenceStoreTest.php b/tests/Predis/Command/SetDifferenceStoreTest.php index abcde008..b575f38a 100644 --- a/tests/Predis/Command/SetDifferenceStoreTest.php +++ b/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 */ diff --git a/tests/Predis/Command/SetDifferenceTest.php b/tests/Predis/Command/SetDifferenceTest.php index d6f90af1..e8318f13 100644 --- a/tests/Predis/Command/SetDifferenceTest.php +++ b/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 */ diff --git a/tests/Predis/Command/SetIntersectionStoreTest.php b/tests/Predis/Command/SetIntersectionStoreTest.php index 4af3c378..cd68398a 100644 --- a/tests/Predis/Command/SetIntersectionStoreTest.php +++ b/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 */ diff --git a/tests/Predis/Command/SetIntersectionTest.php b/tests/Predis/Command/SetIntersectionTest.php index 2a22b330..f9f4c164 100644 --- a/tests/Predis/Command/SetIntersectionTest.php +++ b/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 */ diff --git a/tests/Predis/Command/SetIsMemberTest.php b/tests/Predis/Command/SetIsMemberTest.php index 35ef65a5..30c5e0ae 100644 --- a/tests/Predis/Command/SetIsMemberTest.php +++ b/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 */ diff --git a/tests/Predis/Command/SetMembersTest.php b/tests/Predis/Command/SetMembersTest.php index 588ea84f..2d8cc4be 100644 --- a/tests/Predis/Command/SetMembersTest.php +++ b/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 */ diff --git a/tests/Predis/Command/SetMoveTest.php b/tests/Predis/Command/SetMoveTest.php index 325ee7f0..dda704dd 100644 --- a/tests/Predis/Command/SetMoveTest.php +++ b/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 */ diff --git a/tests/Predis/Command/SetPopTest.php b/tests/Predis/Command/SetPopTest.php index 0dfd75bb..a72bbf0a 100644 --- a/tests/Predis/Command/SetPopTest.php +++ b/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 */ diff --git a/tests/Predis/Command/SetRandomMemberTest.php b/tests/Predis/Command/SetRandomMemberTest.php index 2316691b..7bc408e6 100644 --- a/tests/Predis/Command/SetRandomMemberTest.php +++ b/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 */ diff --git a/tests/Predis/Command/SetRemoveTest.php b/tests/Predis/Command/SetRemoveTest.php index 2366a71d..ed6e20c8 100644 --- a/tests/Predis/Command/SetRemoveTest.php +++ b/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 */ diff --git a/tests/Predis/Command/SetUnionStoreTest.php b/tests/Predis/Command/SetUnionStoreTest.php index f107336d..9c76d10f 100644 --- a/tests/Predis/Command/SetUnionStoreTest.php +++ b/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 */ diff --git a/tests/Predis/Command/SetUnionTest.php b/tests/Predis/Command/SetUnionTest.php index 25a3d7c0..5f936347 100644 --- a/tests/Predis/Command/SetUnionTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringAppendTest.php b/tests/Predis/Command/StringAppendTest.php index 98e49174..847981ce 100644 --- a/tests/Predis/Command/StringAppendTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringBitCountTest.php b/tests/Predis/Command/StringBitCountTest.php index 17ed0ad3..82ac0dac 100644 --- a/tests/Predis/Command/StringBitCountTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringBitOpTest.php b/tests/Predis/Command/StringBitOpTest.php index 4a760dbd..dacf4b41 100644 --- a/tests/Predis/Command/StringBitOpTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringDecrementByTest.php b/tests/Predis/Command/StringDecrementByTest.php index 6cca378d..a21c9690 100644 --- a/tests/Predis/Command/StringDecrementByTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringDecrementTest.php b/tests/Predis/Command/StringDecrementTest.php index 57426e63..080be9f1 100644 --- a/tests/Predis/Command/StringDecrementTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringGetBitTest.php b/tests/Predis/Command/StringGetBitTest.php index 38a274c6..e945d263 100644 --- a/tests/Predis/Command/StringGetBitTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringGetMultipleTest.php b/tests/Predis/Command/StringGetMultipleTest.php index 7d65810a..f1d7a887 100644 --- a/tests/Predis/Command/StringGetMultipleTest.php +++ b/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 diff --git a/tests/Predis/Command/StringGetRangeTest.php b/tests/Predis/Command/StringGetRangeTest.php index c208c7e4..3f0f74cb 100644 --- a/tests/Predis/Command/StringGetRangeTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringGetSetTest.php b/tests/Predis/Command/StringGetSetTest.php index ac182ce8..d151fda8 100644 --- a/tests/Predis/Command/StringGetSetTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringGetTest.php b/tests/Predis/Command/StringGetTest.php index 92a9c390..7233e229 100644 --- a/tests/Predis/Command/StringGetTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringIncrementByFloatTest.php b/tests/Predis/Command/StringIncrementByFloatTest.php index 4c597594..f3d0dc73 100644 --- a/tests/Predis/Command/StringIncrementByFloatTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringIncrementByTest.php b/tests/Predis/Command/StringIncrementByTest.php index b346d708..711d377c 100644 --- a/tests/Predis/Command/StringIncrementByTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringIncrementTest.php b/tests/Predis/Command/StringIncrementTest.php index 4a60dccb..6e2a1fb0 100644 --- a/tests/Predis/Command/StringIncrementTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringPreciseSetExpireTest.php b/tests/Predis/Command/StringPreciseSetExpireTest.php index 79113b6e..5ce521f7 100644 --- a/tests/Predis/Command/StringPreciseSetExpireTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringSetBitTest.php b/tests/Predis/Command/StringSetBitTest.php index a8fc4bbb..1c1aceef 100644 --- a/tests/Predis/Command/StringSetBitTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringSetExpireTest.php b/tests/Predis/Command/StringSetExpireTest.php index 42cffa6d..34194dfc 100644 --- a/tests/Predis/Command/StringSetExpireTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringSetMultiplePreserveTest.php b/tests/Predis/Command/StringSetMultiplePreserveTest.php index 7c0a8d8d..d2833e35 100644 --- a/tests/Predis/Command/StringSetMultiplePreserveTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringSetMultipleTest.php b/tests/Predis/Command/StringSetMultipleTest.php index fbd5b2fe..f351aa41 100644 --- a/tests/Predis/Command/StringSetMultipleTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringSetRangeTest.php b/tests/Predis/Command/StringSetRangeTest.php index 3cf0188f..e5b70c20 100644 --- a/tests/Predis/Command/StringSetRangeTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringSetTest.php b/tests/Predis/Command/StringSetTest.php index 695ac56e..004ae0fe 100644 --- a/tests/Predis/Command/StringSetTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringStrlenTest.php b/tests/Predis/Command/StringStrlenTest.php index 3a9780f8..947e3e11 100644 --- a/tests/Predis/Command/StringStrlenTest.php +++ b/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 */ diff --git a/tests/Predis/Command/StringSubstrTest.php b/tests/Predis/Command/StringSubstrTest.php index a4ad56c9..2a7a204a 100644 --- a/tests/Predis/Command/StringSubstrTest.php +++ b/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()); + } } diff --git a/tests/Predis/Command/TransactionWatchTest.php b/tests/Predis/Command/TransactionWatchTest.php index 01b1d5e2..b98673ce 100644 --- a/tests/Predis/Command/TransactionWatchTest.php +++ b/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 */ diff --git a/tests/Predis/Command/ZSetAddTest.php b/tests/Predis/Command/ZSetAddTest.php index 83056dd9..74394423 100644 --- a/tests/Predis/Command/ZSetAddTest.php +++ b/tests/Predis/Command/ZSetAddTest.php @@ -85,6 +85,17 @@ class ZSetAddTest 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 */ diff --git a/tests/Predis/Command/ZSetCardinalityTest.php b/tests/Predis/Command/ZSetCardinalityTest.php index d8530b5d..272286f7 100644 --- a/tests/Predis/Command/ZSetCardinalityTest.php +++ b/tests/Predis/Command/ZSetCardinalityTest.php @@ -71,6 +71,17 @@ class ZSetCardinalityTest 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 */ diff --git a/tests/Predis/Command/ZSetCountTest.php b/tests/Predis/Command/ZSetCountTest.php index 7dda70bb..19c288c4 100644 --- a/tests/Predis/Command/ZSetCountTest.php +++ b/tests/Predis/Command/ZSetCountTest.php @@ -71,6 +71,17 @@ class ZSetCountTest 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 */ diff --git a/tests/Predis/Command/ZSetIncrementByTest.php b/tests/Predis/Command/ZSetIncrementByTest.php index 96ddecc2..45fe321f 100644 --- a/tests/Predis/Command/ZSetIncrementByTest.php +++ b/tests/Predis/Command/ZSetIncrementByTest.php @@ -71,6 +71,17 @@ class ZSetIncrementByTest 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 */ diff --git a/tests/Predis/Command/ZSetIntersectionStoreTest.php b/tests/Predis/Command/ZSetIntersectionStoreTest.php index 2fa7f5f6..084b661f 100644 --- a/tests/Predis/Command/ZSetIntersectionStoreTest.php +++ b/tests/Predis/Command/ZSetIntersectionStoreTest.php @@ -107,6 +107,17 @@ class ZSetIntersectionStoreTest 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 */ diff --git a/tests/Predis/Command/ZSetRangeByScoreTest.php b/tests/Predis/Command/ZSetRangeByScoreTest.php index 3618ca72..37110df7 100644 --- a/tests/Predis/Command/ZSetRangeByScoreTest.php +++ b/tests/Predis/Command/ZSetRangeByScoreTest.php @@ -127,6 +127,17 @@ class ZSetRangeByScoreTest 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 */ diff --git a/tests/Predis/Command/ZSetRangeTest.php b/tests/Predis/Command/ZSetRangeTest.php index ba40e12b..4ef10b6f 100644 --- a/tests/Predis/Command/ZSetRangeTest.php +++ b/tests/Predis/Command/ZSetRangeTest.php @@ -103,6 +103,17 @@ class ZSetRangeTest 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 */ diff --git a/tests/Predis/Command/ZSetRankTest.php b/tests/Predis/Command/ZSetRankTest.php index 18ddb6ee..4070a262 100644 --- a/tests/Predis/Command/ZSetRankTest.php +++ b/tests/Predis/Command/ZSetRankTest.php @@ -71,6 +71,17 @@ class ZSetRankTest 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 */ diff --git a/tests/Predis/Command/ZSetRemoveRangeByRankTest.php b/tests/Predis/Command/ZSetRemoveRangeByRankTest.php index b62dc278..01499b59 100644 --- a/tests/Predis/Command/ZSetRemoveRangeByRankTest.php +++ b/tests/Predis/Command/ZSetRemoveRangeByRankTest.php @@ -71,6 +71,17 @@ class ZSetRemoveRangeByRankTest 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 */ diff --git a/tests/Predis/Command/ZSetRemoveRangeByScoreTest.php b/tests/Predis/Command/ZSetRemoveRangeByScoreTest.php index bf549039..3e145a3e 100644 --- a/tests/Predis/Command/ZSetRemoveRangeByScoreTest.php +++ b/tests/Predis/Command/ZSetRemoveRangeByScoreTest.php @@ -71,6 +71,17 @@ class ZSetRemoveRangeByScoreTest 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 */ diff --git a/tests/Predis/Command/ZSetRemoveTest.php b/tests/Predis/Command/ZSetRemoveTest.php index 4f93ee58..0fe8ae8d 100644 --- a/tests/Predis/Command/ZSetRemoveTest.php +++ b/tests/Predis/Command/ZSetRemoveTest.php @@ -71,6 +71,17 @@ class ZSetRemoveTest 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 */ diff --git a/tests/Predis/Command/ZSetReverseRangeByScoreTest.php b/tests/Predis/Command/ZSetReverseRangeByScoreTest.php index 625d75c7..6cfaa862 100644 --- a/tests/Predis/Command/ZSetReverseRangeByScoreTest.php +++ b/tests/Predis/Command/ZSetReverseRangeByScoreTest.php @@ -127,6 +127,17 @@ class ZSetReverseRangeByScoreTest 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 */ diff --git a/tests/Predis/Command/ZSetReverseRangeTest.php b/tests/Predis/Command/ZSetReverseRangeTest.php index acc7fa91..58b17dd6 100644 --- a/tests/Predis/Command/ZSetReverseRangeTest.php +++ b/tests/Predis/Command/ZSetReverseRangeTest.php @@ -103,6 +103,17 @@ class ZSetReverseRangeTest 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 */ diff --git a/tests/Predis/Command/ZSetReverseRankTest.php b/tests/Predis/Command/ZSetReverseRankTest.php index 6df08423..10434d5b 100644 --- a/tests/Predis/Command/ZSetReverseRankTest.php +++ b/tests/Predis/Command/ZSetReverseRankTest.php @@ -71,6 +71,17 @@ class ZSetReverseRankTest 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 */ diff --git a/tests/Predis/Command/ZSetScoreTest.php b/tests/Predis/Command/ZSetScoreTest.php index fb7f89da..929a4278 100644 --- a/tests/Predis/Command/ZSetScoreTest.php +++ b/tests/Predis/Command/ZSetScoreTest.php @@ -71,6 +71,17 @@ class ZSetScoreTest 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 */ diff --git a/tests/Predis/Command/ZSetUnionStoreTest.php b/tests/Predis/Command/ZSetUnionStoreTest.php index d109ed95..2569c0c2 100644 --- a/tests/Predis/Command/ZSetUnionStoreTest.php +++ b/tests/Predis/Command/ZSetUnionStoreTest.php @@ -106,6 +106,17 @@ class ZSetUnionStoreTest 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 */