From d0b431016d777913cc05691a53d73adca507004d Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Fri, 29 Nov 2013 15:32:21 +0100 Subject: [PATCH] Move key prefixing logic from command classes to prefix processor. While command classes define how the client should filter arguments or parse responses, key prefixing depends on the actual command signature as defined by Redis so it really is something that should be handled separately as the norm. Developers can define new handlers or override existing ones, but they can still define the key prefixing logic inside their command classes by implementing Predis\Command\PrefixableCommandInterface: the key prefix processor will just use that by overriding any defined handler. --- CHANGELOG.md | 5 + lib/Predis/Command/HashDelete.php | 2 +- lib/Predis/Command/HashExists.php | 2 +- lib/Predis/Command/HashGet.php | 2 +- lib/Predis/Command/HashGetAll.php | 2 +- lib/Predis/Command/HashGetMultiple.php | 2 +- lib/Predis/Command/HashIncrementBy.php | 2 +- lib/Predis/Command/HashIncrementByFloat.php | 2 +- lib/Predis/Command/HashKeys.php | 2 +- lib/Predis/Command/HashLength.php | 2 +- lib/Predis/Command/HashScan.php | 2 +- lib/Predis/Command/HashSet.php | 2 +- lib/Predis/Command/HashSetMultiple.php | 2 +- lib/Predis/Command/HashSetPreserve.php | 2 +- lib/Predis/Command/HashValues.php | 2 +- lib/Predis/Command/KeyDelete.php | 10 +- lib/Predis/Command/KeyDump.php | 2 +- lib/Predis/Command/KeyExists.php | 2 +- lib/Predis/Command/KeyExpire.php | 2 +- lib/Predis/Command/KeyExpireAt.php | 2 +- lib/Predis/Command/KeyKeys.php | 2 +- lib/Predis/Command/KeyMove.php | 2 +- lib/Predis/Command/KeyPersist.php | 2 +- lib/Predis/Command/KeyRename.php | 10 +- lib/Predis/Command/KeyRestore.php | 2 +- lib/Predis/Command/KeySort.php | 36 +- lib/Predis/Command/KeyTimeToLive.php | 2 +- lib/Predis/Command/KeyType.php | 2 +- lib/Predis/Command/ListIndex.php | 2 +- lib/Predis/Command/ListInsert.php | 2 +- lib/Predis/Command/ListLength.php | 2 +- lib/Predis/Command/ListPopFirst.php | 2 +- lib/Predis/Command/ListPopFirstBlocking.php | 10 +- lib/Predis/Command/ListPopLast.php | 2 +- lib/Predis/Command/ListPopLastPushHead.php | 10 +- .../Command/ListPopLastPushHeadBlocking.php | 10 +- lib/Predis/Command/ListPushHeadX.php | 2 +- lib/Predis/Command/ListPushTail.php | 2 +- lib/Predis/Command/ListPushTailX.php | 2 +- lib/Predis/Command/ListRange.php | 2 +- lib/Predis/Command/ListRemove.php | 2 +- lib/Predis/Command/ListSet.php | 2 +- lib/Predis/Command/ListTrim.php | 2 +- lib/Predis/Command/PrefixHelpers.php | 108 --- lib/Predis/Command/PrefixableCommand.php | 31 - .../Command/PrefixableCommandInterface.php | 2 +- .../Command/Processor/KeyPrefixProcessor.php | 319 +++++++- lib/Predis/Command/PubSubPublish.php | 2 +- lib/Predis/Command/PubSubSubscribe.php | 10 +- lib/Predis/Command/PubSubUnsubscribe.php | 10 +- lib/Predis/Command/ServerEval.php | 16 +- lib/Predis/Command/SetAdd.php | 2 +- lib/Predis/Command/SetCardinality.php | 2 +- lib/Predis/Command/SetIntersection.php | 10 +- lib/Predis/Command/SetIntersectionStore.php | 10 +- lib/Predis/Command/SetIsMember.php | 2 +- lib/Predis/Command/SetMembers.php | 2 +- lib/Predis/Command/SetMove.php | 10 +- lib/Predis/Command/SetPop.php | 2 +- lib/Predis/Command/SetRandomMember.php | 2 +- lib/Predis/Command/SetRemove.php | 2 +- lib/Predis/Command/SetScan.php | 2 +- lib/Predis/Command/StringAppend.php | 2 +- lib/Predis/Command/StringBitCount.php | 2 +- lib/Predis/Command/StringBitOp.php | 10 +- lib/Predis/Command/StringDecrement.php | 2 +- lib/Predis/Command/StringDecrementBy.php | 2 +- lib/Predis/Command/StringGet.php | 2 +- lib/Predis/Command/StringGetBit.php | 2 +- lib/Predis/Command/StringGetMultiple.php | 10 +- lib/Predis/Command/StringGetRange.php | 2 +- lib/Predis/Command/StringGetSet.php | 2 +- lib/Predis/Command/StringIncrement.php | 2 +- lib/Predis/Command/StringIncrementBy.php | 2 +- lib/Predis/Command/StringIncrementByFloat.php | 2 +- lib/Predis/Command/StringSet.php | 2 +- lib/Predis/Command/StringSetBit.php | 2 +- lib/Predis/Command/StringSetExpire.php | 2 +- lib/Predis/Command/StringSetMultiple.php | 10 +- lib/Predis/Command/StringSetPreserve.php | 2 +- lib/Predis/Command/StringSetRange.php | 2 +- lib/Predis/Command/StringStrlen.php | 2 +- lib/Predis/Command/StringSubstr.php | 2 +- lib/Predis/Command/TransactionWatch.php | 10 +- lib/Predis/Command/ZSetAdd.php | 2 +- lib/Predis/Command/ZSetCardinality.php | 2 +- lib/Predis/Command/ZSetCount.php | 2 +- lib/Predis/Command/ZSetIncrementBy.php | 2 +- lib/Predis/Command/ZSetRange.php | 2 +- lib/Predis/Command/ZSetRank.php | 2 +- lib/Predis/Command/ZSetRemove.php | 2 +- lib/Predis/Command/ZSetRemoveRangeByRank.php | 2 +- lib/Predis/Command/ZSetRemoveRangeByScore.php | 2 +- lib/Predis/Command/ZSetReverseRank.php | 2 +- lib/Predis/Command/ZSetScan.php | 2 +- lib/Predis/Command/ZSetScore.php | 2 +- lib/Predis/Command/ZSetUnionStore.php | 19 +- tests/Predis/Command/HashDeleteTest.php | 25 - tests/Predis/Command/HashExistsTest.php | 25 - tests/Predis/Command/HashGetAllTest.php | 25 - tests/Predis/Command/HashGetMultipleTest.php | 25 - tests/Predis/Command/HashGetTest.php | 25 - .../Command/HashIncrementByFloatTest.php | 25 - tests/Predis/Command/HashIncrementByTest.php | 25 - tests/Predis/Command/HashKeysTest.php | 25 - tests/Predis/Command/HashLengthTest.php | 25 - tests/Predis/Command/HashScanTest.php | 25 - tests/Predis/Command/HashSetMultipleTest.php | 25 - tests/Predis/Command/HashSetPreserveTest.php | 25 - tests/Predis/Command/HashSetTest.php | 25 - tests/Predis/Command/HashValuesTest.php | 25 - tests/Predis/Command/KeyDeleteTest.php | 25 - tests/Predis/Command/KeyDumpTest.php | 25 - tests/Predis/Command/KeyExistsTest.php | 25 - tests/Predis/Command/KeyExpireAtTest.php | 25 - tests/Predis/Command/KeyExpireTest.php | 25 - tests/Predis/Command/KeyKeysTest.php | 25 - tests/Predis/Command/KeyKeysV12xTest.php | 25 - tests/Predis/Command/KeyMoveTest.php | 25 - tests/Predis/Command/KeyPersistTest.php | 25 - .../Predis/Command/KeyPreciseExpireAtTest.php | 25 - tests/Predis/Command/KeyPreciseExpireTest.php | 25 - .../Command/KeyPreciseTimeToLiveTest.php | 25 - .../Predis/Command/KeyRenamePreserveTest.php | 25 - tests/Predis/Command/KeyRenameTest.php | 25 - tests/Predis/Command/KeyRestoreTest.php | 25 - tests/Predis/Command/KeySortTest.php | 37 - tests/Predis/Command/KeyTimeToLiveTest.php | 25 - tests/Predis/Command/KeyTypeTest.php | 25 - tests/Predis/Command/ListIndexTest.php | 25 - tests/Predis/Command/ListInsertTest.php | 25 - tests/Predis/Command/ListLengthTest.php | 25 - .../Command/ListPopFirstBlockingTest.php | 25 - tests/Predis/Command/ListPopFirstTest.php | 25 - .../Command/ListPopLastBlockingTest.php | 25 - .../ListPopLastPushHeadBlockingTest.php | 25 - .../Command/ListPopLastPushHeadTest.php | 25 - tests/Predis/Command/ListPopLastTest.php | 25 - tests/Predis/Command/ListPushHeadTest.php | 25 - tests/Predis/Command/ListPushHeadXTest.php | 25 - tests/Predis/Command/ListPushTailTest.php | 25 - tests/Predis/Command/ListPushTailXTest.php | 25 - tests/Predis/Command/ListRangeTest.php | 25 - tests/Predis/Command/ListRemoveTest.php | 25 - tests/Predis/Command/ListSetTest.php | 25 - tests/Predis/Command/ListTrimTest.php | 25 - tests/Predis/Command/PrefixHelpersTest.php | 84 -- .../Predis/Command/PrefixableCommandTest.php | 54 -- .../Processor/KeyPrefixProcessorTest.php | 759 +++++++++++++++++- tests/Predis/Command/PubSubPublishTest.php | 25 - .../Command/PubSubSubscribeByPatternTest.php | 25 - tests/Predis/Command/PubSubSubscribeTest.php | 25 - .../PubSubUnsubscribeByPatternTest.php | 25 - .../Predis/Command/PubSubUnsubscribeTest.php | 25 - tests/Predis/Command/ScriptedCommandTest.php | 44 - tests/Predis/Command/ServerEvalSHATest.php | 27 - tests/Predis/Command/ServerEvalTest.php | 27 - tests/Predis/Command/SetAddTest.php | 25 - tests/Predis/Command/SetCardinalityTest.php | 25 - .../Predis/Command/SetDifferenceStoreTest.php | 25 - tests/Predis/Command/SetDifferenceTest.php | 25 - .../Command/SetIntersectionStoreTest.php | 25 - tests/Predis/Command/SetIntersectionTest.php | 25 - tests/Predis/Command/SetIsMemberTest.php | 25 - tests/Predis/Command/SetMembersTest.php | 25 - tests/Predis/Command/SetMoveTest.php | 25 - tests/Predis/Command/SetPopTest.php | 25 - tests/Predis/Command/SetRandomMemberTest.php | 25 - tests/Predis/Command/SetRemoveTest.php | 25 - tests/Predis/Command/SetScanTest.php | 25 - tests/Predis/Command/SetUnionStoreTest.php | 25 - tests/Predis/Command/SetUnionTest.php | 25 - tests/Predis/Command/StringAppendTest.php | 25 - tests/Predis/Command/StringBitCountTest.php | 25 - tests/Predis/Command/StringBitOpTest.php | 25 - .../Predis/Command/StringDecrementByTest.php | 25 - tests/Predis/Command/StringDecrementTest.php | 25 - tests/Predis/Command/StringGetBitTest.php | 25 - .../Predis/Command/StringGetMultipleTest.php | 25 - tests/Predis/Command/StringGetRangeTest.php | 25 - tests/Predis/Command/StringGetSetTest.php | 25 - tests/Predis/Command/StringGetTest.php | 25 - .../Command/StringIncrementByFloatTest.php | 25 - .../Predis/Command/StringIncrementByTest.php | 25 - tests/Predis/Command/StringIncrementTest.php | 25 - .../Command/StringPreciseSetExpireTest.php | 25 - tests/Predis/Command/StringSetBitTest.php | 25 - tests/Predis/Command/StringSetExpireTest.php | 25 - .../Command/StringSetMultiplePreserveTest.php | 25 - .../Predis/Command/StringSetMultipleTest.php | 25 - tests/Predis/Command/StringSetRangeTest.php | 25 - tests/Predis/Command/StringSetTest.php | 25 - tests/Predis/Command/StringStrlenTest.php | 25 - tests/Predis/Command/StringSubstrTest.php | 25 - tests/Predis/Command/TransactionWatchTest.php | 25 - tests/Predis/Command/ZSetAddTest.php | 25 - tests/Predis/Command/ZSetCardinalityTest.php | 25 - tests/Predis/Command/ZSetCountTest.php | 25 - tests/Predis/Command/ZSetIncrementByTest.php | 25 - .../Command/ZSetIntersectionStoreTest.php | 33 - tests/Predis/Command/ZSetRangeByScoreTest.php | 30 - tests/Predis/Command/ZSetRangeTest.php | 25 - tests/Predis/Command/ZSetRankTest.php | 25 - .../Command/ZSetRemoveRangeByRankTest.php | 25 - .../Command/ZSetRemoveRangeByScoreTest.php | 25 - tests/Predis/Command/ZSetRemoveTest.php | 25 - .../Command/ZSetReverseRangeByScoreTest.php | 30 - tests/Predis/Command/ZSetReverseRangeTest.php | 25 - tests/Predis/Command/ZSetReverseRankTest.php | 25 - tests/Predis/Command/ZSetScanTest.php | 25 - tests/Predis/Command/ZSetScoreTest.php | 25 - tests/Predis/Command/ZSetUnionStoreTest.php | 32 - 212 files changed, 1149 insertions(+), 3434 deletions(-) delete mode 100644 lib/Predis/Command/PrefixHelpers.php delete mode 100644 lib/Predis/Command/PrefixableCommand.php delete mode 100644 tests/Predis/Command/PrefixHelpersTest.php delete mode 100644 tests/Predis/Command/PrefixableCommandTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 1218f1b3..6ac257b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,11 @@ v0.9.0 (201x-xx-xx) - The profile factory code has been extrapolated from the abstract Redis profile class and it's now in `Predis\Profile\Factory`. +- The key prefixing logic has been moved from command classes to the key prefix + processor. Developers can define or override handlers used to prefix keys, but + they can also define the needed logic in their command classes by implementing + `Predis\Command\PrefixableCommandInterface` just like before. + v0.8.5 (2013-xx-xx) =============================================================================== diff --git a/lib/Predis/Command/HashDelete.php b/lib/Predis/Command/HashDelete.php index 4ccc99bf..2887df77 100644 --- a/lib/Predis/Command/HashDelete.php +++ b/lib/Predis/Command/HashDelete.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/hdel * @author Daniele Alessandri */ -class HashDelete extends PrefixableCommand +class HashDelete extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/HashExists.php b/lib/Predis/Command/HashExists.php index a9d620a0..817b46e2 100644 --- a/lib/Predis/Command/HashExists.php +++ b/lib/Predis/Command/HashExists.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/hexists * @author Daniele Alessandri */ -class HashExists extends PrefixableCommand +class HashExists extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/HashGet.php b/lib/Predis/Command/HashGet.php index b18583af..fa29f104 100644 --- a/lib/Predis/Command/HashGet.php +++ b/lib/Predis/Command/HashGet.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/hget * @author Daniele Alessandri */ -class HashGet extends PrefixableCommand +class HashGet extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/HashGetAll.php b/lib/Predis/Command/HashGetAll.php index 51a745f7..a3022f9e 100644 --- a/lib/Predis/Command/HashGetAll.php +++ b/lib/Predis/Command/HashGetAll.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/hgetall * @author Daniele Alessandri */ -class HashGetAll extends PrefixableCommand +class HashGetAll extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/HashGetMultiple.php b/lib/Predis/Command/HashGetMultiple.php index ed4468da..1e093efa 100644 --- a/lib/Predis/Command/HashGetMultiple.php +++ b/lib/Predis/Command/HashGetMultiple.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/hmget * @author Daniele Alessandri */ -class HashGetMultiple extends PrefixableCommand +class HashGetMultiple extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/HashIncrementBy.php b/lib/Predis/Command/HashIncrementBy.php index 1c43e637..e76d0df3 100644 --- a/lib/Predis/Command/HashIncrementBy.php +++ b/lib/Predis/Command/HashIncrementBy.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/hincrby * @author Daniele Alessandri */ -class HashIncrementBy extends PrefixableCommand +class HashIncrementBy extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/HashIncrementByFloat.php b/lib/Predis/Command/HashIncrementByFloat.php index 75970588..d79b82c2 100644 --- a/lib/Predis/Command/HashIncrementByFloat.php +++ b/lib/Predis/Command/HashIncrementByFloat.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/hincrbyfloat * @author Daniele Alessandri */ -class HashIncrementByFloat extends PrefixableCommand +class HashIncrementByFloat extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/HashKeys.php b/lib/Predis/Command/HashKeys.php index 279f09a9..b81830cf 100644 --- a/lib/Predis/Command/HashKeys.php +++ b/lib/Predis/Command/HashKeys.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/hkeys * @author Daniele Alessandri */ -class HashKeys extends PrefixableCommand +class HashKeys extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/HashLength.php b/lib/Predis/Command/HashLength.php index b2a59c0a..16653352 100644 --- a/lib/Predis/Command/HashLength.php +++ b/lib/Predis/Command/HashLength.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/hlen * @author Daniele Alessandri */ -class HashLength extends PrefixableCommand +class HashLength extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/HashScan.php b/lib/Predis/Command/HashScan.php index febe74d5..b8496ebb 100644 --- a/lib/Predis/Command/HashScan.php +++ b/lib/Predis/Command/HashScan.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/hscan * @author Daniele Alessandri */ -class HashScan extends PrefixableCommand +class HashScan extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/HashSet.php b/lib/Predis/Command/HashSet.php index 588afc40..ced71ad3 100644 --- a/lib/Predis/Command/HashSet.php +++ b/lib/Predis/Command/HashSet.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/hset * @author Daniele Alessandri */ -class HashSet extends PrefixableCommand +class HashSet extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/HashSetMultiple.php b/lib/Predis/Command/HashSetMultiple.php index b51ea66f..d3bb9af3 100644 --- a/lib/Predis/Command/HashSetMultiple.php +++ b/lib/Predis/Command/HashSetMultiple.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/hmset * @author Daniele Alessandri */ -class HashSetMultiple extends PrefixableCommand +class HashSetMultiple extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/HashSetPreserve.php b/lib/Predis/Command/HashSetPreserve.php index 3e9890aa..5689a3f1 100644 --- a/lib/Predis/Command/HashSetPreserve.php +++ b/lib/Predis/Command/HashSetPreserve.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/hsetnx * @author Daniele Alessandri */ -class HashSetPreserve extends PrefixableCommand +class HashSetPreserve extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/HashValues.php b/lib/Predis/Command/HashValues.php index fec31167..3a36570d 100644 --- a/lib/Predis/Command/HashValues.php +++ b/lib/Predis/Command/HashValues.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/hvals * @author Daniele Alessandri */ -class HashValues extends PrefixableCommand +class HashValues extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/KeyDelete.php b/lib/Predis/Command/KeyDelete.php index 04ff83a8..237a6eef 100644 --- a/lib/Predis/Command/KeyDelete.php +++ b/lib/Predis/Command/KeyDelete.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/del * @author Daniele Alessandri */ -class KeyDelete extends AbstractCommand implements PrefixableCommandInterface +class KeyDelete extends AbstractCommand { /** * {@inheritdoc} @@ -32,12 +32,4 @@ class KeyDelete extends AbstractCommand implements PrefixableCommandInterface { return self::normalizeArguments($arguments); } - - /** - * {@inheritdoc} - */ - public function prefixKeys($prefix) - { - PrefixHelpers::all($this, $prefix); - } } diff --git a/lib/Predis/Command/KeyDump.php b/lib/Predis/Command/KeyDump.php index 55cb90b6..fe806055 100644 --- a/lib/Predis/Command/KeyDump.php +++ b/lib/Predis/Command/KeyDump.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/dump * @author Daniele Alessandri */ -class KeyDump extends PrefixableCommand +class KeyDump extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/KeyExists.php b/lib/Predis/Command/KeyExists.php index 7f877cdb..b621fc60 100644 --- a/lib/Predis/Command/KeyExists.php +++ b/lib/Predis/Command/KeyExists.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/exists * @author Daniele Alessandri */ -class KeyExists extends PrefixableCommand +class KeyExists extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/KeyExpire.php b/lib/Predis/Command/KeyExpire.php index 9db8e029..b3a505e4 100644 --- a/lib/Predis/Command/KeyExpire.php +++ b/lib/Predis/Command/KeyExpire.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/expire * @author Daniele Alessandri */ -class KeyExpire extends PrefixableCommand +class KeyExpire extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/KeyExpireAt.php b/lib/Predis/Command/KeyExpireAt.php index 1f6db38f..3075e388 100644 --- a/lib/Predis/Command/KeyExpireAt.php +++ b/lib/Predis/Command/KeyExpireAt.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/expireat * @author Daniele Alessandri */ -class KeyExpireAt extends PrefixableCommand +class KeyExpireAt extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/KeyKeys.php b/lib/Predis/Command/KeyKeys.php index 3b973edd..e3172d64 100644 --- a/lib/Predis/Command/KeyKeys.php +++ b/lib/Predis/Command/KeyKeys.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/keys * @author Daniele Alessandri */ -class KeyKeys extends PrefixableCommand +class KeyKeys extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/KeyMove.php b/lib/Predis/Command/KeyMove.php index 9e2a64da..4bc44de5 100644 --- a/lib/Predis/Command/KeyMove.php +++ b/lib/Predis/Command/KeyMove.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/move * @author Daniele Alessandri */ -class KeyMove extends PrefixableCommand +class KeyMove extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/KeyPersist.php b/lib/Predis/Command/KeyPersist.php index 5c6b23cf..30b92cb6 100644 --- a/lib/Predis/Command/KeyPersist.php +++ b/lib/Predis/Command/KeyPersist.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/persist * @author Daniele Alessandri */ -class KeyPersist extends PrefixableCommand +class KeyPersist extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/KeyRename.php b/lib/Predis/Command/KeyRename.php index 49af1ffe..b7ca908b 100644 --- a/lib/Predis/Command/KeyRename.php +++ b/lib/Predis/Command/KeyRename.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/rename * @author Daniele Alessandri */ -class KeyRename extends AbstractCommand implements PrefixableCommandInterface +class KeyRename extends AbstractCommand { /** * {@inheritdoc} @@ -24,12 +24,4 @@ class KeyRename extends AbstractCommand implements PrefixableCommandInterface { return 'RENAME'; } - - /** - * {@inheritdoc} - */ - public function prefixKeys($prefix) - { - PrefixHelpers::all($this, $prefix); - } } diff --git a/lib/Predis/Command/KeyRestore.php b/lib/Predis/Command/KeyRestore.php index 623cef6d..02d7c297 100644 --- a/lib/Predis/Command/KeyRestore.php +++ b/lib/Predis/Command/KeyRestore.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/restore * @author Daniele Alessandri */ -class KeyRestore extends PrefixableCommand +class KeyRestore extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/KeySort.php b/lib/Predis/Command/KeySort.php index 7d2058d2..c1ad2d1b 100644 --- a/lib/Predis/Command/KeySort.php +++ b/lib/Predis/Command/KeySort.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/sort * @author Daniele Alessandri */ -class KeySort extends AbstractCommand implements PrefixableCommandInterface +class KeySort extends AbstractCommand { /** * {@inheritdoc} @@ -80,38 +80,4 @@ class KeySort extends AbstractCommand implements PrefixableCommandInterface return $query; } - - /** - * {@inheritdoc} - */ - public function prefixKeys($prefix) - { - 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); - } - } } diff --git a/lib/Predis/Command/KeyTimeToLive.php b/lib/Predis/Command/KeyTimeToLive.php index 103885a6..76afe28a 100644 --- a/lib/Predis/Command/KeyTimeToLive.php +++ b/lib/Predis/Command/KeyTimeToLive.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/ttl * @author Daniele Alessandri */ -class KeyTimeToLive extends PrefixableCommand +class KeyTimeToLive extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/KeyType.php b/lib/Predis/Command/KeyType.php index b2baf9b4..01b7eb6e 100644 --- a/lib/Predis/Command/KeyType.php +++ b/lib/Predis/Command/KeyType.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/type * @author Daniele Alessandri */ -class KeyType extends PrefixableCommand +class KeyType extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ListIndex.php b/lib/Predis/Command/ListIndex.php index 9762ebf8..669d309c 100644 --- a/lib/Predis/Command/ListIndex.php +++ b/lib/Predis/Command/ListIndex.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/lindex * @author Daniele Alessandri */ -class ListIndex extends PrefixableCommand +class ListIndex extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ListInsert.php b/lib/Predis/Command/ListInsert.php index 289f9b45..e8ee455c 100644 --- a/lib/Predis/Command/ListInsert.php +++ b/lib/Predis/Command/ListInsert.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/linsert * @author Daniele Alessandri */ -class ListInsert extends PrefixableCommand +class ListInsert extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ListLength.php b/lib/Predis/Command/ListLength.php index c46dad4f..c1340a6b 100644 --- a/lib/Predis/Command/ListLength.php +++ b/lib/Predis/Command/ListLength.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/llen * @author Daniele Alessandri */ -class ListLength extends PrefixableCommand +class ListLength extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ListPopFirst.php b/lib/Predis/Command/ListPopFirst.php index f1afc4e4..067e8558 100644 --- a/lib/Predis/Command/ListPopFirst.php +++ b/lib/Predis/Command/ListPopFirst.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/lpop * @author Daniele Alessandri */ -class ListPopFirst extends PrefixableCommand +class ListPopFirst extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ListPopFirstBlocking.php b/lib/Predis/Command/ListPopFirstBlocking.php index ad29f03d..929c7c72 100644 --- a/lib/Predis/Command/ListPopFirstBlocking.php +++ b/lib/Predis/Command/ListPopFirstBlocking.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/blpop * @author Daniele Alessandri */ -class ListPopFirstBlocking extends AbstractCommand implements PrefixableCommandInterface +class ListPopFirstBlocking extends AbstractCommand { /** * {@inheritdoc} @@ -37,12 +37,4 @@ class ListPopFirstBlocking extends AbstractCommand implements PrefixableCommandI return $arguments; } - - /** - * {@inheritdoc} - */ - public function prefixKeys($prefix) - { - PrefixHelpers::skipLast($this, $prefix); - } } diff --git a/lib/Predis/Command/ListPopLast.php b/lib/Predis/Command/ListPopLast.php index a161f908..11316392 100644 --- a/lib/Predis/Command/ListPopLast.php +++ b/lib/Predis/Command/ListPopLast.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/rpop * @author Daniele Alessandri */ -class ListPopLast extends PrefixableCommand +class ListPopLast extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ListPopLastPushHead.php b/lib/Predis/Command/ListPopLastPushHead.php index 761b6124..a51435c3 100644 --- a/lib/Predis/Command/ListPopLastPushHead.php +++ b/lib/Predis/Command/ListPopLastPushHead.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/rpoplpush * @author Daniele Alessandri */ -class ListPopLastPushHead extends AbstractCommand implements PrefixableCommandInterface +class ListPopLastPushHead extends AbstractCommand { /** * {@inheritdoc} @@ -24,12 +24,4 @@ class ListPopLastPushHead extends AbstractCommand implements PrefixableCommandIn { return 'RPOPLPUSH'; } - - /** - * {@inheritdoc} - */ - public function prefixKeys($prefix) - { - PrefixHelpers::all($this, $prefix); - } } diff --git a/lib/Predis/Command/ListPopLastPushHeadBlocking.php b/lib/Predis/Command/ListPopLastPushHeadBlocking.php index 3ef14071..317b0dfe 100644 --- a/lib/Predis/Command/ListPopLastPushHeadBlocking.php +++ b/lib/Predis/Command/ListPopLastPushHeadBlocking.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/brpoplpush * @author Daniele Alessandri */ -class ListPopLastPushHeadBlocking extends AbstractCommand implements PrefixableCommandInterface +class ListPopLastPushHeadBlocking extends AbstractCommand { /** * {@inheritdoc} @@ -24,12 +24,4 @@ class ListPopLastPushHeadBlocking extends AbstractCommand implements PrefixableC { return 'BRPOPLPUSH'; } - - /** - * {@inheritdoc} - */ - public function prefixKeys($prefix) - { - PrefixHelpers::skipLast($this, $prefix); - } } diff --git a/lib/Predis/Command/ListPushHeadX.php b/lib/Predis/Command/ListPushHeadX.php index 2cb671ec..4f942610 100644 --- a/lib/Predis/Command/ListPushHeadX.php +++ b/lib/Predis/Command/ListPushHeadX.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/lpushx * @author Daniele Alessandri */ -class ListPushHeadX extends PrefixableCommand +class ListPushHeadX extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ListPushTail.php b/lib/Predis/Command/ListPushTail.php index 094cec1e..f15ffa0d 100644 --- a/lib/Predis/Command/ListPushTail.php +++ b/lib/Predis/Command/ListPushTail.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/rpush * @author Daniele Alessandri */ -class ListPushTail extends PrefixableCommand +class ListPushTail extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ListPushTailX.php b/lib/Predis/Command/ListPushTailX.php index af42a52f..34adc23f 100644 --- a/lib/Predis/Command/ListPushTailX.php +++ b/lib/Predis/Command/ListPushTailX.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/rpushx * @author Daniele Alessandri */ -class ListPushTailX extends PrefixableCommand +class ListPushTailX extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ListRange.php b/lib/Predis/Command/ListRange.php index 2b2e945e..7e3ba11b 100644 --- a/lib/Predis/Command/ListRange.php +++ b/lib/Predis/Command/ListRange.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/lrange * @author Daniele Alessandri */ -class ListRange extends PrefixableCommand +class ListRange extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ListRemove.php b/lib/Predis/Command/ListRemove.php index 98f88540..7e7e1670 100644 --- a/lib/Predis/Command/ListRemove.php +++ b/lib/Predis/Command/ListRemove.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/lrem * @author Daniele Alessandri */ -class ListRemove extends PrefixableCommand +class ListRemove extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ListSet.php b/lib/Predis/Command/ListSet.php index 0ea1ee73..50c6a3aa 100644 --- a/lib/Predis/Command/ListSet.php +++ b/lib/Predis/Command/ListSet.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/lset * @author Daniele Alessandri */ -class ListSet extends PrefixableCommand +class ListSet extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ListTrim.php b/lib/Predis/Command/ListTrim.php index 80d73e5b..86be8b71 100644 --- a/lib/Predis/Command/ListTrim.php +++ b/lib/Predis/Command/ListTrim.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/ltrim * @author Daniele Alessandri */ -class ListTrim extends PrefixableCommand +class ListTrim extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/PrefixHelpers.php b/lib/Predis/Command/PrefixHelpers.php deleted file mode 100644 index 0c37d6f8..00000000 --- a/lib/Predis/Command/PrefixHelpers.php +++ /dev/null @@ -1,108 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Predis\Command; - -/** - * Class that defines a few helpers method for prefixing keys. - * - * @author Daniele Alessandri - */ -class PrefixHelpers -{ - /** - * Applies the specified prefix only the first argument. - * - * @param CommandInterface $command Command instance. - * @param string $prefix Prefix string. - */ - public static function first(CommandInterface $command, $prefix) - { - if ($arguments = $command->getArguments()) { - $arguments[0] = "$prefix{$arguments[0]}"; - $command->setRawArguments($arguments); - } - } - - /** - * Applies the specified prefix to all the arguments. - * - * @param CommandInterface $command Command instance. - * @param string $prefix Prefix string. - */ - public static function all(CommandInterface $command, $prefix) - { - if ($arguments = $command->getArguments()) { - foreach ($arguments as &$key) { - $key = "$prefix$key"; - } - - $command->setRawArguments($arguments); - } - } - - /** - * Applies the specified prefix only to even arguments in the list. - * - * @param CommandInterface $command Command instance. - * @param string $prefix Prefix string. - */ - public static function interleaved(CommandInterface $command, $prefix) - { - if ($arguments = $command->getArguments()) { - $length = count($arguments); - - for ($i = 0; $i < $length; $i += 2) { - $arguments[$i] = "$prefix{$arguments[$i]}"; - } - - $command->setRawArguments($arguments); - } - } - - /** - * Applies the specified prefix to all the arguments but the first one. - * - * @param CommandInterface $command Command instance. - * @param string $prefix Prefix string. - */ - public static function skipFirst(CommandInterface $command, $prefix) - { - if ($arguments = $command->getArguments()) { - $length = count($arguments); - - for ($i = 1; $i < $length; $i++) { - $arguments[$i] = "$prefix{$arguments[$i]}"; - } - - $command->setRawArguments($arguments); - } - } - - /** - * Applies the specified prefix to all the arguments but the last one. - * - * @param CommandInterface $command Command instance. - * @param string $prefix Prefix string. - */ - public static function skipLast(CommandInterface $command, $prefix) - { - if ($arguments = $command->getArguments()) { - $length = count($arguments); - - for ($i = 0; $i < $length - 1; $i++) { - $arguments[$i] = "$prefix{$arguments[$i]}"; - } - - $command->setRawArguments($arguments); - } - } -} diff --git a/lib/Predis/Command/PrefixableCommand.php b/lib/Predis/Command/PrefixableCommand.php deleted file mode 100644 index 7112e87d..00000000 --- a/lib/Predis/Command/PrefixableCommand.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Predis\Command; - -/** - * Base class for Redis commands with prefixable keys. - * - * @author Daniele Alessandri - */ -abstract class PrefixableCommand extends AbstractCommand implements PrefixableCommandInterface -{ - /** - * {@inheritdoc} - */ - public function prefixKeys($prefix) - { - if ($arguments = $this->getArguments()) { - $arguments[0] = "$prefix{$arguments[0]}"; - $this->setRawArguments($arguments); - } - } -} diff --git a/lib/Predis/Command/PrefixableCommandInterface.php b/lib/Predis/Command/PrefixableCommandInterface.php index acb99a22..6d54554f 100644 --- a/lib/Predis/Command/PrefixableCommandInterface.php +++ b/lib/Predis/Command/PrefixableCommandInterface.php @@ -16,7 +16,7 @@ namespace Predis\Command; * * @author Daniele Alessandri */ -interface PrefixableCommandInterface +interface PrefixableCommandInterface extends CommandInterface { /** * Prefixes all the keys found in the arguments of the command. diff --git a/lib/Predis/Command/Processor/KeyPrefixProcessor.php b/lib/Predis/Command/Processor/KeyPrefixProcessor.php index ed0d17fa..13e8adac 100644 --- a/lib/Predis/Command/Processor/KeyPrefixProcessor.php +++ b/lib/Predis/Command/Processor/KeyPrefixProcessor.php @@ -23,13 +23,132 @@ use Predis\Command\PrefixableCommandInterface; class KeyPrefixProcessor implements CommandProcessorInterface { private $prefix; + private $commands; /** * @param string $prefix Prefix for the keys. */ public function __construct($prefix) { - $this->setPrefix($prefix); + $this->prefix = $prefix; + $this->commands = array( + /* ---------------- Redis 1.2 ---------------- */ + 'EXISTS' => 'self::first', + 'DEL' => 'self::all', + 'TYPE' => 'self::first', + 'KEYS' => 'self::first', + 'RENAME' => 'self::all', + 'RENAMENX' => 'self::all', + 'EXPIRE' => 'self::first', + 'EXPIREAT' => 'self::first', + 'TTL' => 'self::first', + 'MOVE' => 'self::first', + 'SORT' => 'self::sort', + 'DUMP' => 'self::first', + 'RESTORE' => 'self::first', + 'SET' => 'self::first', + 'SETNX' => 'self::first', + 'MSET' => 'self::interleaved', + 'MSETNX' => 'self::interleaved', + 'GET' => 'self::first', + 'MGET' => 'self::all', + 'GETSET' => 'self::first', + 'INCR' => 'self::first', + 'INCRBY' => 'self::first', + 'DECR' => 'self::first', + 'DECRBY' => 'self::first', + 'RPUSH' => 'self::first', + 'LPUSH' => 'self::first', + 'LLEN' => 'self::first', + 'LRANGE' => 'self::first', + 'LTRIM' => 'self::first', + 'LINDEX' => 'self::first', + 'LSET' => 'self::first', + 'LREM' => 'self::first', + 'LPOP' => 'self::first', + 'RPOP' => 'self::first', + 'RPOPLPUSH' => 'self::all', + 'SADD' => 'self::first', + 'SREM' => 'self::first', + 'SPOP' => 'self::first', + 'SMOVE' => 'self::skipLast', + 'SCARD' => 'self::first', + 'SISMEMBER' => 'self::first', + 'SINTER' => 'self::all', + 'SINTERSTORE' => 'self::all', + 'SUNION' => 'self::all', + 'SUNIONSTORE' => 'self::all', + 'SDIFF' => 'self::all', + 'SDIFFSTORE' => 'self::all', + 'SMEMBERS' => 'self::first', + 'SRANDMEMBER' => 'self::first', + 'ZADD' => 'self::first', + 'ZINCRBY' => 'self::first', + 'ZREM' => 'self::first', + 'ZRANGE' => 'self::first', + 'ZREVRANGE' => 'self::first', + 'ZRANGEBYSCORE' => 'self::first', + 'ZCARD' => 'self::first', + 'ZSCORE' => 'self::first', + 'ZREMRANGEBYSCORE' => 'self::first', + /* ---------------- Redis 2.0 ---------------- */ + 'SETEX' => 'self::first', + 'APPEND' => 'self::first', + 'SUBSTR' => 'self::first', + 'BLPOP' => 'self::skipLast', + 'BRPOP' => 'self::skipLast', + 'ZUNIONSTORE' => 'self::zsetStore', + 'ZINTERSTORE' => 'self::zsetStore', + 'ZCOUNT' => 'self::first', + 'ZRANK' => 'self::first', + 'ZREVRANK' => 'self::first', + 'ZREMRANGEBYRANK' => 'self::first', + 'HSET' => 'self::first', + 'HSETNX' => 'self::first', + 'HMSET' => 'self::first', + 'HINCRBY' => 'self::first', + 'HGET' => 'self::first', + 'HMGET' => 'self::first', + 'HDEL' => 'self::first', + 'HEXISTS' => 'self::first', + 'HLEN' => 'self::first', + 'HKEYS' => 'self::first', + 'HVALS' => 'self::first', + 'HGETALL' => 'self::first', + 'SUBSCRIBE' => 'self::all', + 'UNSUBSCRIBE' => 'self::all', + 'PSUBSCRIBE' => 'self::all', + 'PUNSUBSCRIBE' => 'self::all', + 'PUBLISH' => 'self::first', + /* ---------------- Redis 2.2 ---------------- */ + 'PERSIST' => 'self::first', + 'STRLEN' => 'self::first', + 'SETRANGE' => 'self::first', + 'GETRANGE' => 'self::first', + 'SETBIT' => 'self::first', + 'GETBIT' => 'self::first', + 'RPUSHX' => 'self::first', + 'LPUSHX' => 'self::first', + 'LINSERT' => 'self::first', + 'BRPOPLPUSH' => 'self::skipLast', + 'ZREVRANGEBYSCORE' => 'self::first', + 'WATCH' => 'self::all', + /* ---------------- Redis 2.6 ---------------- */ + 'PTTL' => 'self::first', + 'PEXPIRE' => 'self::first', + 'PEXPIREAT' => 'self::first', + 'PSETEX' => 'self::first', + 'INCRBYFLOAT' => 'self::first', + 'BITOP' => 'self::skipFirst', + 'BITCOUNT' => 'self::first', + 'HINCRBYFLOAT' => 'self::first', + 'EVAL' => 'self::evalKeys', + 'EVALSHA' => 'self::evalKeys', + /* ---------------- Redis 2.8 ---------------- */ + 'SSCAN' => 'self::first', + 'ZSCAN' => 'self::first', + 'HSCAN' => 'self::first', + ); } /** @@ -57,11 +176,45 @@ class KeyPrefixProcessor implements CommandProcessorInterface */ public function process(CommandInterface $command) { - if ($command instanceof PrefixableCommandInterface && $command->getArguments()) { + if ($command instanceof PrefixableCommandInterface) { $command->prefixKeys($this->prefix); + } else if (isset($this->commands[$commandID = strtoupper($command->getId())])) { + call_user_func($this->commands[$commandID], $command, $this->prefix); } } + /** + * Sets an handler for the specified command ID. + * + * The callback signature must have 2 parameters of the following types: + * + * - Predis\Command\CommandInterface (command instance) + * - String (prefix) + * + * When the callback argument is omitted or NULL, the previously + * associated handler for the specified command ID is removed. + * + * @param string $commandID The ID of the command to be handled. + * @param mixed $callback A valid callable object or NULL. + */ + public function setCommandHandler($commandID, $callback = null) + { + $commandID = strtoupper($commandID); + + if (!isset($callback)) { + unset($this->commands[$commandID]); + return; + } + + if (!is_callable($callback)) { + throw new InvalidArgumentException( + "Callback must be a valid callable object or NULL" + ); + } + + $this->commands[$commandID] = $callback; + } + /** * {@inheritdoc} */ @@ -69,4 +222,166 @@ class KeyPrefixProcessor implements CommandProcessorInterface { return $this->getPrefix(); } + + /** + * Applies the specified prefix only the first argument. + * + * @param CommandInterface $command Command instance. + * @param string $prefix Prefix string. + */ + public static function first(CommandInterface $command, $prefix) + { + if ($arguments = $command->getArguments()) { + $arguments[0] = "$prefix{$arguments[0]}"; + $command->setRawArguments($arguments); + } + } + + /** + * Applies the specified prefix to all the arguments. + * + * @param CommandInterface $command Command instance. + * @param string $prefix Prefix string. + */ + public static function all(CommandInterface $command, $prefix) + { + if ($arguments = $command->getArguments()) { + foreach ($arguments as &$key) { + $key = "$prefix$key"; + } + + $command->setRawArguments($arguments); + } + } + + /** + * Applies the specified prefix only to even arguments in the list. + * + * @param CommandInterface $command Command instance. + * @param string $prefix Prefix string. + */ + public static function interleaved(CommandInterface $command, $prefix) + { + if ($arguments = $command->getArguments()) { + $length = count($arguments); + + for ($i = 0; $i < $length; $i += 2) { + $arguments[$i] = "$prefix{$arguments[$i]}"; + } + + $command->setRawArguments($arguments); + } + } + + /** + * Applies the specified prefix to all the arguments but the first one. + * + * @param CommandInterface $command Command instance. + * @param string $prefix Prefix string. + */ + public static function skipFirst(CommandInterface $command, $prefix) + { + if ($arguments = $command->getArguments()) { + $length = count($arguments); + + for ($i = 1; $i < $length; $i++) { + $arguments[$i] = "$prefix{$arguments[$i]}"; + } + + $command->setRawArguments($arguments); + } + } + + /** + * Applies the specified prefix to all the arguments but the last one. + * + * @param CommandInterface $command Command instance. + * @param string $prefix Prefix string. + */ + public static function skipLast(CommandInterface $command, $prefix) + { + if ($arguments = $command->getArguments()) { + $length = count($arguments); + + for ($i = 0; $i < $length - 1; $i++) { + $arguments[$i] = "$prefix{$arguments[$i]}"; + } + + $command->setRawArguments($arguments); + } + } + + /** + * Applies the specified prefix to the keys of a SORT command. + * + * @param CommandInterface $command Command instance. + * @param string $prefix Prefix string. + */ + public static function sort(CommandInterface $command, $prefix) + { + if ($arguments = $command->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; + } + } + } + + $command->setRawArguments($arguments); + } + } + + /** + * Applies the specified prefix to the keys of an EVAL-based command. + * + * @param CommandInterface $command Command instance. + * @param string $prefix Prefix string. + */ + public static function evalKeys(CommandInterface $command, $prefix) + { + if ($arguments = $command->getArguments()) { + for ($i = 2; $i < $arguments[1] + 2; $i++) { + $arguments[$i] = "$prefix{$arguments[$i]}"; + } + + $command->setRawArguments($arguments); + } + } + + /** + * Applies the specified prefix to the keys of Z[INTERSECTION|UNION]STORE. + * + * @param CommandInterface $command Command instance. + * @param string $prefix Prefix string. + */ + public static function zsetStore(CommandInterface $command, $prefix) + { + if ($arguments = $command->getArguments()) { + $arguments[0] = "$prefix{$arguments[0]}"; + $length = ((int) $arguments[1]) + 2; + + for ($i = 2; $i < $length; $i++) { + $arguments[$i] = "$prefix{$arguments[$i]}"; + } + + $command->setRawArguments($arguments); + } + } } diff --git a/lib/Predis/Command/PubSubPublish.php b/lib/Predis/Command/PubSubPublish.php index b2ecce51..3260c6b9 100644 --- a/lib/Predis/Command/PubSubPublish.php +++ b/lib/Predis/Command/PubSubPublish.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/publish * @author Daniele Alessandri */ -class PubSubPublish extends PrefixableCommand +class PubSubPublish extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/PubSubSubscribe.php b/lib/Predis/Command/PubSubSubscribe.php index 29e8de99..c5797b0b 100644 --- a/lib/Predis/Command/PubSubSubscribe.php +++ b/lib/Predis/Command/PubSubSubscribe.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/subscribe * @author Daniele Alessandri */ -class PubSubSubscribe extends AbstractCommand implements PrefixableCommandInterface +class PubSubSubscribe extends AbstractCommand { /** * {@inheritdoc} @@ -32,12 +32,4 @@ class PubSubSubscribe extends AbstractCommand implements PrefixableCommandInterf { return self::normalizeArguments($arguments); } - - /** - * {@inheritdoc} - */ - public function prefixKeys($prefix) - { - PrefixHelpers::all($this, $prefix); - } } diff --git a/lib/Predis/Command/PubSubUnsubscribe.php b/lib/Predis/Command/PubSubUnsubscribe.php index f384e130..d2618f02 100644 --- a/lib/Predis/Command/PubSubUnsubscribe.php +++ b/lib/Predis/Command/PubSubUnsubscribe.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/unsubscribe * @author Daniele Alessandri */ -class PubSubUnsubscribe extends AbstractCommand implements PrefixableCommandInterface +class PubSubUnsubscribe extends AbstractCommand { /** * {@inheritdoc} @@ -32,12 +32,4 @@ class PubSubUnsubscribe extends AbstractCommand implements PrefixableCommandInte { return self::normalizeArguments($arguments); } - - /** - * {@inheritdoc} - */ - public function prefixKeys($prefix) - { - PrefixHelpers::all($this, $prefix); - } } diff --git a/lib/Predis/Command/ServerEval.php b/lib/Predis/Command/ServerEval.php index 0c1f1828..6b878237 100644 --- a/lib/Predis/Command/ServerEval.php +++ b/lib/Predis/Command/ServerEval.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/eval * @author Daniele Alessandri */ -class ServerEval extends AbstractCommand implements PrefixableCommandInterface +class ServerEval extends AbstractCommand { /** * {@inheritdoc} @@ -25,20 +25,6 @@ class ServerEval extends AbstractCommand implements PrefixableCommandInterface return 'EVAL'; } - /** - * {@inheritdoc} - */ - public function prefixKeys($prefix) - { - if ($arguments = $this->getArguments()) { - for ($i = 2; $i < $arguments[1] + 2; $i++) { - $arguments[$i] = "$prefix{$arguments[$i]}"; - } - - $this->setRawArguments($arguments); - } - } - /** * Calculates the SHA1 hash of the body of the script. * diff --git a/lib/Predis/Command/SetAdd.php b/lib/Predis/Command/SetAdd.php index c9246b7c..e6bcd18d 100644 --- a/lib/Predis/Command/SetAdd.php +++ b/lib/Predis/Command/SetAdd.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/sadd * @author Daniele Alessandri */ -class SetAdd extends PrefixableCommand +class SetAdd extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/SetCardinality.php b/lib/Predis/Command/SetCardinality.php index 8e6e48e0..853bcd27 100644 --- a/lib/Predis/Command/SetCardinality.php +++ b/lib/Predis/Command/SetCardinality.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/scard * @author Daniele Alessandri */ -class SetCardinality extends PrefixableCommand +class SetCardinality extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/SetIntersection.php b/lib/Predis/Command/SetIntersection.php index 54f1afec..f7786145 100644 --- a/lib/Predis/Command/SetIntersection.php +++ b/lib/Predis/Command/SetIntersection.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/sinter * @author Daniele Alessandri */ -class SetIntersection extends AbstractCommand implements PrefixableCommandInterface +class SetIntersection extends AbstractCommand { /** * {@inheritdoc} @@ -32,12 +32,4 @@ class SetIntersection extends AbstractCommand implements PrefixableCommandInterf { return self::normalizeArguments($arguments); } - - /** - * {@inheritdoc} - */ - public function prefixKeys($prefix) - { - PrefixHelpers::all($this, $prefix); - } } diff --git a/lib/Predis/Command/SetIntersectionStore.php b/lib/Predis/Command/SetIntersectionStore.php index 60b55879..b148163f 100644 --- a/lib/Predis/Command/SetIntersectionStore.php +++ b/lib/Predis/Command/SetIntersectionStore.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/sinterstore * @author Daniele Alessandri */ -class SetIntersectionStore extends AbstractCommand implements PrefixableCommandInterface +class SetIntersectionStore extends AbstractCommand { /** * {@inheritdoc} @@ -36,12 +36,4 @@ class SetIntersectionStore extends AbstractCommand implements PrefixableCommandI return $arguments; } - - /** - * {@inheritdoc} - */ - public function prefixKeys($prefix) - { - PrefixHelpers::all($this, $prefix); - } } diff --git a/lib/Predis/Command/SetIsMember.php b/lib/Predis/Command/SetIsMember.php index 07735209..bf8cbf7a 100644 --- a/lib/Predis/Command/SetIsMember.php +++ b/lib/Predis/Command/SetIsMember.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/sismember * @author Daniele Alessandri */ -class SetIsMember extends PrefixableCommand +class SetIsMember extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/SetMembers.php b/lib/Predis/Command/SetMembers.php index 3ebef0a1..9062b6de 100644 --- a/lib/Predis/Command/SetMembers.php +++ b/lib/Predis/Command/SetMembers.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/smembers * @author Daniele Alessandri */ -class SetMembers extends PrefixableCommand +class SetMembers extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/SetMove.php b/lib/Predis/Command/SetMove.php index 01678ec7..230dd343 100644 --- a/lib/Predis/Command/SetMove.php +++ b/lib/Predis/Command/SetMove.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/smove * @author Daniele Alessandri */ -class SetMove extends AbstractCommand implements PrefixableCommandInterface +class SetMove extends AbstractCommand { /** * {@inheritdoc} @@ -25,14 +25,6 @@ class SetMove extends AbstractCommand implements PrefixableCommandInterface return 'SMOVE'; } - /** - * {@inheritdoc} - */ - public function prefixKeys($prefix) - { - PrefixHelpers::skipLast($this, $prefix); - } - /** * {@inheritdoc} */ diff --git a/lib/Predis/Command/SetPop.php b/lib/Predis/Command/SetPop.php index ebfec0cc..e5d414c0 100644 --- a/lib/Predis/Command/SetPop.php +++ b/lib/Predis/Command/SetPop.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/spop * @author Daniele Alessandri */ -class SetPop extends PrefixableCommand +class SetPop extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/SetRandomMember.php b/lib/Predis/Command/SetRandomMember.php index a6b6062e..9ac0d6e7 100644 --- a/lib/Predis/Command/SetRandomMember.php +++ b/lib/Predis/Command/SetRandomMember.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/srandmember * @author Daniele Alessandri */ -class SetRandomMember extends PrefixableCommand +class SetRandomMember extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/SetRemove.php b/lib/Predis/Command/SetRemove.php index 002d8f96..a234514f 100644 --- a/lib/Predis/Command/SetRemove.php +++ b/lib/Predis/Command/SetRemove.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/srem * @author Daniele Alessandri */ -class SetRemove extends PrefixableCommand +class SetRemove extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/SetScan.php b/lib/Predis/Command/SetScan.php index 602b2b82..714700ea 100644 --- a/lib/Predis/Command/SetScan.php +++ b/lib/Predis/Command/SetScan.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/sscan * @author Daniele Alessandri */ -class SetScan extends PrefixableCommand +class SetScan extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/StringAppend.php b/lib/Predis/Command/StringAppend.php index 8d146148..654e01f5 100644 --- a/lib/Predis/Command/StringAppend.php +++ b/lib/Predis/Command/StringAppend.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/append * @author Daniele Alessandri */ -class StringAppend extends PrefixableCommand +class StringAppend extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/StringBitCount.php b/lib/Predis/Command/StringBitCount.php index 19d534b0..457eca86 100644 --- a/lib/Predis/Command/StringBitCount.php +++ b/lib/Predis/Command/StringBitCount.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/bitcount * @author Daniele Alessandri */ -class StringBitCount extends PrefixableCommand +class StringBitCount extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/StringBitOp.php b/lib/Predis/Command/StringBitOp.php index 512ffed4..ed62c02a 100644 --- a/lib/Predis/Command/StringBitOp.php +++ b/lib/Predis/Command/StringBitOp.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/bitop * @author Daniele Alessandri */ -class StringBitOp extends AbstractCommand implements PrefixableCommandInterface +class StringBitOp extends AbstractCommand { /** * {@inheritdoc} @@ -38,12 +38,4 @@ class StringBitOp extends AbstractCommand implements PrefixableCommandInterface return $arguments; } - - /** - * {@inheritdoc} - */ - public function prefixKeys($prefix) - { - PrefixHelpers::skipFirst($this, $prefix); - } } diff --git a/lib/Predis/Command/StringDecrement.php b/lib/Predis/Command/StringDecrement.php index 0e45cd0d..aec33c83 100644 --- a/lib/Predis/Command/StringDecrement.php +++ b/lib/Predis/Command/StringDecrement.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/decr * @author Daniele Alessandri */ -class StringDecrement extends PrefixableCommand +class StringDecrement extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/StringDecrementBy.php b/lib/Predis/Command/StringDecrementBy.php index e716e0eb..47df62e9 100644 --- a/lib/Predis/Command/StringDecrementBy.php +++ b/lib/Predis/Command/StringDecrementBy.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/decrby * @author Daniele Alessandri */ -class StringDecrementBy extends PrefixableCommand +class StringDecrementBy extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/StringGet.php b/lib/Predis/Command/StringGet.php index 851c7100..685d8cdf 100644 --- a/lib/Predis/Command/StringGet.php +++ b/lib/Predis/Command/StringGet.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/get * @author Daniele Alessandri */ -class StringGet extends PrefixableCommand +class StringGet extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/StringGetBit.php b/lib/Predis/Command/StringGetBit.php index 954c39fd..84d010dd 100644 --- a/lib/Predis/Command/StringGetBit.php +++ b/lib/Predis/Command/StringGetBit.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/getbit * @author Daniele Alessandri */ -class StringGetBit extends PrefixableCommand +class StringGetBit extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/StringGetMultiple.php b/lib/Predis/Command/StringGetMultiple.php index bb1a777c..4cb27884 100644 --- a/lib/Predis/Command/StringGetMultiple.php +++ b/lib/Predis/Command/StringGetMultiple.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/mget * @author Daniele Alessandri */ -class StringGetMultiple extends AbstractCommand implements PrefixableCommandInterface +class StringGetMultiple extends AbstractCommand { /** * {@inheritdoc} @@ -32,12 +32,4 @@ class StringGetMultiple extends AbstractCommand implements PrefixableCommandInte { return self::normalizeArguments($arguments); } - - /** - * {@inheritdoc} - */ - public function prefixKeys($prefix) - { - PrefixHelpers::all($this, $prefix); - } } diff --git a/lib/Predis/Command/StringGetRange.php b/lib/Predis/Command/StringGetRange.php index aed48536..bcaa83c1 100644 --- a/lib/Predis/Command/StringGetRange.php +++ b/lib/Predis/Command/StringGetRange.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/getrange * @author Daniele Alessandri */ -class StringGetRange extends PrefixableCommand +class StringGetRange extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/StringGetSet.php b/lib/Predis/Command/StringGetSet.php index d4b8e230..aac20749 100644 --- a/lib/Predis/Command/StringGetSet.php +++ b/lib/Predis/Command/StringGetSet.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/getset * @author Daniele Alessandri */ -class StringGetSet extends PrefixableCommand +class StringGetSet extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/StringIncrement.php b/lib/Predis/Command/StringIncrement.php index 4848afcb..36c7a368 100644 --- a/lib/Predis/Command/StringIncrement.php +++ b/lib/Predis/Command/StringIncrement.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/incr * @author Daniele Alessandri */ -class StringIncrement extends PrefixableCommand +class StringIncrement extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/StringIncrementBy.php b/lib/Predis/Command/StringIncrementBy.php index 7fa31880..a6a71a40 100644 --- a/lib/Predis/Command/StringIncrementBy.php +++ b/lib/Predis/Command/StringIncrementBy.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/incrby * @author Daniele Alessandri */ -class StringIncrementBy extends PrefixableCommand +class StringIncrementBy extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/StringIncrementByFloat.php b/lib/Predis/Command/StringIncrementByFloat.php index 7e14dff3..96b678a9 100644 --- a/lib/Predis/Command/StringIncrementByFloat.php +++ b/lib/Predis/Command/StringIncrementByFloat.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/incrbyfloat * @author Daniele Alessandri */ -class StringIncrementByFloat extends PrefixableCommand +class StringIncrementByFloat extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/StringSet.php b/lib/Predis/Command/StringSet.php index eb3739b3..d1bb0236 100644 --- a/lib/Predis/Command/StringSet.php +++ b/lib/Predis/Command/StringSet.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/set * @author Daniele Alessandri */ -class StringSet extends PrefixableCommand +class StringSet extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/StringSetBit.php b/lib/Predis/Command/StringSetBit.php index a92b4185..52f50063 100644 --- a/lib/Predis/Command/StringSetBit.php +++ b/lib/Predis/Command/StringSetBit.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/setbit * @author Daniele Alessandri */ -class StringSetBit extends PrefixableCommand +class StringSetBit extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/StringSetExpire.php b/lib/Predis/Command/StringSetExpire.php index c235e2bf..ac17a509 100644 --- a/lib/Predis/Command/StringSetExpire.php +++ b/lib/Predis/Command/StringSetExpire.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/setex * @author Daniele Alessandri */ -class StringSetExpire extends PrefixableCommand +class StringSetExpire extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/StringSetMultiple.php b/lib/Predis/Command/StringSetMultiple.php index c81c2c6e..057ca4a3 100644 --- a/lib/Predis/Command/StringSetMultiple.php +++ b/lib/Predis/Command/StringSetMultiple.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/mset * @author Daniele Alessandri */ -class StringSetMultiple extends AbstractCommand implements PrefixableCommandInterface +class StringSetMultiple extends AbstractCommand { /** * {@inheritdoc} @@ -44,12 +44,4 @@ class StringSetMultiple extends AbstractCommand implements PrefixableCommandInte return $arguments; } - - /** - * {@inheritdoc} - */ - public function prefixKeys($prefix) - { - PrefixHelpers::interleaved($this, $prefix); - } } diff --git a/lib/Predis/Command/StringSetPreserve.php b/lib/Predis/Command/StringSetPreserve.php index d6e4a813..d4e1806a 100644 --- a/lib/Predis/Command/StringSetPreserve.php +++ b/lib/Predis/Command/StringSetPreserve.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/setnx * @author Daniele Alessandri */ -class StringSetPreserve extends PrefixableCommand +class StringSetPreserve extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/StringSetRange.php b/lib/Predis/Command/StringSetRange.php index da30f32d..b7812cbc 100644 --- a/lib/Predis/Command/StringSetRange.php +++ b/lib/Predis/Command/StringSetRange.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/setrange * @author Daniele Alessandri */ -class StringSetRange extends PrefixableCommand +class StringSetRange extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/StringStrlen.php b/lib/Predis/Command/StringStrlen.php index 1b839add..f7e5c3ae 100644 --- a/lib/Predis/Command/StringStrlen.php +++ b/lib/Predis/Command/StringStrlen.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/strlen * @author Daniele Alessandri */ -class StringStrlen extends PrefixableCommand +class StringStrlen extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/StringSubstr.php b/lib/Predis/Command/StringSubstr.php index 671fc169..5d158033 100644 --- a/lib/Predis/Command/StringSubstr.php +++ b/lib/Predis/Command/StringSubstr.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/substr * @author Daniele Alessandri */ -class StringSubstr extends PrefixableCommand +class StringSubstr extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/TransactionWatch.php b/lib/Predis/Command/TransactionWatch.php index 69b24bbc..eeea3e0b 100644 --- a/lib/Predis/Command/TransactionWatch.php +++ b/lib/Predis/Command/TransactionWatch.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/watch * @author Daniele Alessandri */ -class TransactionWatch extends AbstractCommand implements PrefixableCommandInterface +class TransactionWatch extends AbstractCommand { /** * {@inheritdoc} @@ -37,14 +37,6 @@ class TransactionWatch extends AbstractCommand implements PrefixableCommandInter return $arguments; } - /** - * {@inheritdoc} - */ - public function prefixKeys($prefix) - { - PrefixHelpers::all($this, $prefix); - } - /** * {@inheritdoc} */ diff --git a/lib/Predis/Command/ZSetAdd.php b/lib/Predis/Command/ZSetAdd.php index a4befb25..c1726243 100644 --- a/lib/Predis/Command/ZSetAdd.php +++ b/lib/Predis/Command/ZSetAdd.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/zadd * @author Daniele Alessandri */ -class ZSetAdd extends PrefixableCommand +class ZSetAdd extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ZSetCardinality.php b/lib/Predis/Command/ZSetCardinality.php index 4e4432e6..7ced0ffa 100644 --- a/lib/Predis/Command/ZSetCardinality.php +++ b/lib/Predis/Command/ZSetCardinality.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/zcard * @author Daniele Alessandri */ -class ZSetCardinality extends PrefixableCommand +class ZSetCardinality extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ZSetCount.php b/lib/Predis/Command/ZSetCount.php index 2d8aa9ca..ad939c04 100644 --- a/lib/Predis/Command/ZSetCount.php +++ b/lib/Predis/Command/ZSetCount.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/zcount * @author Daniele Alessandri */ -class ZSetCount extends PrefixableCommand +class ZSetCount extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ZSetIncrementBy.php b/lib/Predis/Command/ZSetIncrementBy.php index a32bfabd..959406e9 100644 --- a/lib/Predis/Command/ZSetIncrementBy.php +++ b/lib/Predis/Command/ZSetIncrementBy.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/zincrby * @author Daniele Alessandri */ -class ZSetIncrementBy extends PrefixableCommand +class ZSetIncrementBy extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ZSetRange.php b/lib/Predis/Command/ZSetRange.php index e64e5e10..3bb729bd 100644 --- a/lib/Predis/Command/ZSetRange.php +++ b/lib/Predis/Command/ZSetRange.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/zrange * @author Daniele Alessandri */ -class ZSetRange extends PrefixableCommand +class ZSetRange extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ZSetRank.php b/lib/Predis/Command/ZSetRank.php index 41c2ae2a..484a8510 100644 --- a/lib/Predis/Command/ZSetRank.php +++ b/lib/Predis/Command/ZSetRank.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/zrank * @author Daniele Alessandri */ -class ZSetRank extends PrefixableCommand +class ZSetRank extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ZSetRemove.php b/lib/Predis/Command/ZSetRemove.php index b1b77ce4..590e5af4 100644 --- a/lib/Predis/Command/ZSetRemove.php +++ b/lib/Predis/Command/ZSetRemove.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/zrem * @author Daniele Alessandri */ -class ZSetRemove extends PrefixableCommand +class ZSetRemove extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ZSetRemoveRangeByRank.php b/lib/Predis/Command/ZSetRemoveRangeByRank.php index 45b90284..f48fec07 100644 --- a/lib/Predis/Command/ZSetRemoveRangeByRank.php +++ b/lib/Predis/Command/ZSetRemoveRangeByRank.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/zremrangebyrank * @author Daniele Alessandri */ -class ZSetRemoveRangeByRank extends PrefixableCommand +class ZSetRemoveRangeByRank extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ZSetRemoveRangeByScore.php b/lib/Predis/Command/ZSetRemoveRangeByScore.php index a2b3ad8d..1b65e14d 100644 --- a/lib/Predis/Command/ZSetRemoveRangeByScore.php +++ b/lib/Predis/Command/ZSetRemoveRangeByScore.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/zremrangebyscore * @author Daniele Alessandri */ -class ZSetRemoveRangeByScore extends PrefixableCommand +class ZSetRemoveRangeByScore extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ZSetReverseRank.php b/lib/Predis/Command/ZSetReverseRank.php index feb10487..acd31921 100644 --- a/lib/Predis/Command/ZSetReverseRank.php +++ b/lib/Predis/Command/ZSetReverseRank.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/zrevrank * @author Daniele Alessandri */ -class ZSetReverseRank extends PrefixableCommand +class ZSetReverseRank extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ZSetScan.php b/lib/Predis/Command/ZSetScan.php index 7d84a8c6..cf13e9a1 100644 --- a/lib/Predis/Command/ZSetScan.php +++ b/lib/Predis/Command/ZSetScan.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/zscan * @author Daniele Alessandri */ -class ZSetScan extends PrefixableCommand +class ZSetScan extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ZSetScore.php b/lib/Predis/Command/ZSetScore.php index 8455e4ef..a8e24748 100644 --- a/lib/Predis/Command/ZSetScore.php +++ b/lib/Predis/Command/ZSetScore.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/zscore * @author Daniele Alessandri */ -class ZSetScore extends PrefixableCommand +class ZSetScore extends AbstractCommand { /** * {@inheritdoc} diff --git a/lib/Predis/Command/ZSetUnionStore.php b/lib/Predis/Command/ZSetUnionStore.php index da559893..324691a6 100644 --- a/lib/Predis/Command/ZSetUnionStore.php +++ b/lib/Predis/Command/ZSetUnionStore.php @@ -15,7 +15,7 @@ namespace Predis\Command; * @link http://redis.io/commands/zunionstore * @author Daniele Alessandri */ -class ZSetUnionStore extends PrefixableCommand +class ZSetUnionStore extends AbstractCommand { /** * {@inheritdoc} @@ -73,21 +73,4 @@ class ZSetUnionStore extends PrefixableCommand return $finalizedOpts; } - - /** - * {@inheritdoc} - */ - public function prefixKeys($prefix) - { - if ($arguments = $this->getArguments()) { - $arguments[0] = "$prefix{$arguments[0]}"; - $length = ((int) $arguments[1]) + 2; - - for ($i = 2; $i < $length; $i++) { - $arguments[$i] = "$prefix{$arguments[$i]}"; - } - - $this->setRawArguments($arguments); - } - } } diff --git a/tests/Predis/Command/HashDeleteTest.php b/tests/Predis/Command/HashDeleteTest.php index 90fff5c1..3ea76ec2 100644 --- a/tests/Predis/Command/HashDeleteTest.php +++ b/tests/Predis/Command/HashDeleteTest.php @@ -71,31 +71,6 @@ class HashDeleteTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'field1', 'field2', 'field3'); - $expected = array('prefix:key', 'field1', 'field2', 'field3'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 2b830116..eabd513e 100644 --- a/tests/Predis/Command/HashExistsTest.php +++ b/tests/Predis/Command/HashExistsTest.php @@ -60,31 +60,6 @@ class HashExistsTest extends CommandTestCase $this->assertTrue($command->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'field'); - $expected = array('prefix:key', 'field'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 7655a782..a078ce0e 100644 --- a/tests/Predis/Command/HashGetAllTest.php +++ b/tests/Predis/Command/HashGetAllTest.php @@ -62,31 +62,6 @@ class HashGetAllTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key'); - $expected = array('prefix:key'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 af379829..2b28118a 100644 --- a/tests/Predis/Command/HashGetMultipleTest.php +++ b/tests/Predis/Command/HashGetMultipleTest.php @@ -76,31 +76,6 @@ class HashGetMultipleTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'field1', 'field2', 'field3'); - $expected = array('prefix:key', 'field1', 'field2', 'field3'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 ab56b372..1f60a316 100644 --- a/tests/Predis/Command/HashGetTest.php +++ b/tests/Predis/Command/HashGetTest.php @@ -57,31 +57,6 @@ class HashGetTest extends CommandTestCase $this->assertSame('value', $this->getCommand()->parseResponse('value')); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'field'); - $expected = array('prefix:key', 'field'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 b68fdf7e..ca2ef666 100644 --- a/tests/Predis/Command/HashIncrementByFloatTest.php +++ b/tests/Predis/Command/HashIncrementByFloatTest.php @@ -57,31 +57,6 @@ class HashIncrementByFloatTest extends CommandTestCase $this->assertSame(10.5, $this->getCommand()->parseResponse(10.5)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'field', 10.5); - $expected = array('prefix:key', 'field', 10.5); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 1feabb00..42de193a 100644 --- a/tests/Predis/Command/HashIncrementByTest.php +++ b/tests/Predis/Command/HashIncrementByTest.php @@ -57,31 +57,6 @@ class HashIncrementByTest extends CommandTestCase $this->assertSame(10, $this->getCommand()->parseResponse(10)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'field', 10); - $expected = array('prefix:key', 'field', 10); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 ad7cd887..64ab2cdf 100644 --- a/tests/Predis/Command/HashKeysTest.php +++ b/tests/Predis/Command/HashKeysTest.php @@ -62,31 +62,6 @@ class HashKeysTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key'); - $expected = array('prefix:key'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 6a976746..1887dd0b 100644 --- a/tests/Predis/Command/HashLengthTest.php +++ b/tests/Predis/Command/HashLengthTest.php @@ -57,31 +57,6 @@ class HashLengthTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key'); - $expected = array('prefix:key'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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/HashScanTest.php b/tests/Predis/Command/HashScanTest.php index f568bdfd..a55833d3 100644 --- a/tests/Predis/Command/HashScanTest.php +++ b/tests/Predis/Command/HashScanTest.php @@ -90,31 +90,6 @@ class HashScanTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', '0', 'MATCH', 'field:*', 'COUNT', 10); - $expected = array('prefix:key', '0', 'MATCH', 'field:*', 'COUNT', 10); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 07dba090..ec2befba 100644 --- a/tests/Predis/Command/HashSetMultipleTest.php +++ b/tests/Predis/Command/HashSetMultipleTest.php @@ -71,31 +71,6 @@ class HashSetMultipleTest extends CommandTestCase $this->assertTrue($this->getCommand()->parseResponse(true)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'field1', 'value1', 'field2', 'value2'); - $expected = array('prefix:key', 'field1', 'value1', 'field2', 'value2'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 3eb99aba..7085464d 100644 --- a/tests/Predis/Command/HashSetPreserveTest.php +++ b/tests/Predis/Command/HashSetPreserveTest.php @@ -60,31 +60,6 @@ class HashSetPreserveTest extends CommandTestCase $this->assertFalse($command->parseResponse(0)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'field', 'value'); - $expected = array('prefix:key', 'field', 'value'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 466a75ee..3e93a165 100644 --- a/tests/Predis/Command/HashSetTest.php +++ b/tests/Predis/Command/HashSetTest.php @@ -60,31 +60,6 @@ class HashSetTest extends CommandTestCase $this->assertFalse($command->parseResponse(0)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'field', 'value'); - $expected = array('prefix:key', 'field', 'value'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 6e747482..e18eb0e2 100644 --- a/tests/Predis/Command/HashValuesTest.php +++ b/tests/Predis/Command/HashValuesTest.php @@ -62,31 +62,6 @@ class HashValuesTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key'); - $expected = array('prefix:key'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 fd425012..d062f242 100644 --- a/tests/Predis/Command/KeyDeleteTest.php +++ b/tests/Predis/Command/KeyDeleteTest.php @@ -72,31 +72,6 @@ class KeyDeleteTest extends CommandTestCase $this->assertSame(10, $command->parseResponse(10)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key1', 'key2', 'key3'); - $expected = array('prefix:key1', 'prefix:key2', 'prefix:key3'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 392f08c9..edc885e0 100644 --- a/tests/Predis/Command/KeyDumpTest.php +++ b/tests/Predis/Command/KeyDumpTest.php @@ -61,29 +61,4 @@ class KeyDumpTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key'); - $expected = array('prefix:key'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 0ab20142..95dc9aa4 100644 --- a/tests/Predis/Command/KeyExistsTest.php +++ b/tests/Predis/Command/KeyExistsTest.php @@ -60,31 +60,6 @@ class KeyExistsTest extends CommandTestCase $this->assertFalse($command->parseResponse(0)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key'); - $expected = array('prefix:key'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 f1376051..45d05bc2 100644 --- a/tests/Predis/Command/KeyExpireAtTest.php +++ b/tests/Predis/Command/KeyExpireAtTest.php @@ -60,31 +60,6 @@ class KeyExpireAtTest extends CommandTestCase $this->assertFalse($command->parseResponse(0)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'value'); - $expected = array('prefix:key', 'value'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 9961dafe..69403eef 100644 --- a/tests/Predis/Command/KeyExpireTest.php +++ b/tests/Predis/Command/KeyExpireTest.php @@ -60,31 +60,6 @@ class KeyExpireTest extends CommandTestCase $this->assertFalse($command->parseResponse(0)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'value'); - $expected = array('prefix:key', 'value'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 d8e95a70..89586d92 100644 --- a/tests/Predis/Command/KeyKeysTest.php +++ b/tests/Predis/Command/KeyKeysTest.php @@ -60,31 +60,6 @@ class KeyKeysTest extends CommandTestCase $this->assertSame($parsed, $this->getCommand()->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('pattern'); - $expected = array('prefix:pattern'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 fb936470..41681364 100644 --- a/tests/Predis/Command/KeyKeysV12xTest.php +++ b/tests/Predis/Command/KeyKeysV12xTest.php @@ -63,29 +63,4 @@ class KeyKeysV12xTest extends CommandTestCase $this->assertSame($parsed, $this->getCommand()->parseResponse($raw)); } - - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('pattern'); - $expected = array('prefix:pattern'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 8cdd7d3c..73666639 100644 --- a/tests/Predis/Command/KeyMoveTest.php +++ b/tests/Predis/Command/KeyMoveTest.php @@ -60,31 +60,6 @@ class KeyMoveTest extends CommandTestCase $this->assertFalse($command->parseResponse(0)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'db'); - $expected = array('prefix:key', 'db'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 5c2ee45b..2b29274e 100644 --- a/tests/Predis/Command/KeyPersistTest.php +++ b/tests/Predis/Command/KeyPersistTest.php @@ -60,31 +60,6 @@ class KeyPersistTest extends CommandTestCase $this->assertFalse($command->parseResponse(0)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key'); - $expected = array('prefix:key'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 62905692..c00c2efc 100644 --- a/tests/Predis/Command/KeyPreciseExpireAtTest.php +++ b/tests/Predis/Command/KeyPreciseExpireAtTest.php @@ -60,31 +60,6 @@ class KeyPreciseExpireAtTest extends CommandTestCase $this->assertFalse($command->parseResponse(0)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'value'); - $expected = array('prefix:key', 'value'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $this->assertSame($expected, $command->getArguments()); - } - - /** - * @group disconnected - */ - public function testPrefixKeysIgnoredOnEmptyArguments() - { - $command = $this->getCommand(); - $command->prefixKeys('prefix:'); - - $this->assertSame(array(), $command->getArguments()); - } - /** * @medium * @group connected diff --git a/tests/Predis/Command/KeyPreciseExpireTest.php b/tests/Predis/Command/KeyPreciseExpireTest.php index bbae4f74..e6e42670 100644 --- a/tests/Predis/Command/KeyPreciseExpireTest.php +++ b/tests/Predis/Command/KeyPreciseExpireTest.php @@ -60,31 +60,6 @@ class KeyPreciseExpireTest extends CommandTestCase $this->assertFalse($command->parseResponse(0)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'value'); - $expected = array('prefix:key', 'value'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 0c1b3932..a5cc1c02 100644 --- a/tests/Predis/Command/KeyPreciseTimeToLiveTest.php +++ b/tests/Predis/Command/KeyPreciseTimeToLiveTest.php @@ -59,31 +59,6 @@ class KeyPreciseTimeToLiveTest extends CommandTestCase $this->assertSame(100, $command->parseResponse(100)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 10); - $expected = array('prefix:key', 10); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 ba13b1df..d0e42f7b 100644 --- a/tests/Predis/Command/KeyRenamePreserveTest.php +++ b/tests/Predis/Command/KeyRenamePreserveTest.php @@ -58,31 +58,6 @@ class KeyRenamePreserveTest extends CommandTestCase $this->assertFalse($this->getCommand()->parseResponse(0)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'newkey'); - $expected = array('prefix:key', 'prefix:newkey'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 9d2c6fd3..e40caa99 100644 --- a/tests/Predis/Command/KeyRenameTest.php +++ b/tests/Predis/Command/KeyRenameTest.php @@ -57,31 +57,6 @@ class KeyRenameTest extends CommandTestCase $this->assertTrue($this->getCommand()->parseResponse(true)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'newkey'); - $expected = array('prefix:key', 'prefix:newkey'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 763395b7..76378e99 100644 --- a/tests/Predis/Command/KeyRestoreTest.php +++ b/tests/Predis/Command/KeyRestoreTest.php @@ -56,29 +56,4 @@ class KeyRestoreTest extends CommandTestCase { $this->assertTrue($this->getCommand()->parseResponse(true)); } - - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 0, "\x00\xC0\n\x06\x00\xF8r?\xC5\xFB\xFB_("); - $expected = array('prefix:key', 0, "\x00\xC0\n\x06\x00\xF8r?\xC5\xFB\xFB_("); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 ce3e5188..c8aa9a42 100644 --- a/tests/Predis/Command/KeySortTest.php +++ b/tests/Predis/Command/KeySortTest.php @@ -103,43 +103,6 @@ class KeySortTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $modifiers = array( - 'by' => 'by_key_*', - 'limit' => array(1, 4), - 'get' => array('object_*', '#'), - 'sort' => 'asc', - 'alpha' => true, - 'store' => 'destination_key', - ); - $arguments = array('key', $modifiers); - - $expected = array( - 'prefix:key', 'BY', 'prefix:by_key_*', 'GET', 'prefix:object_*', 'GET', '#', - 'LIMIT', 1, 4, 'ASC', 'ALPHA', 'STORE', 'prefix:destination_key' - ); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 a47c9579..3dee86f9 100644 --- a/tests/Predis/Command/KeyTimeToLiveTest.php +++ b/tests/Predis/Command/KeyTimeToLiveTest.php @@ -59,31 +59,6 @@ class KeyTimeToLiveTest extends CommandTestCase $this->assertSame(100, $command->parseResponse(100)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 10); - $expected = array('prefix:key', 10); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 8173d0ac..65acf313 100644 --- a/tests/Predis/Command/KeyTypeTest.php +++ b/tests/Predis/Command/KeyTypeTest.php @@ -57,31 +57,6 @@ class KeyTypeTest extends CommandTestCase $this->assertSame('type', $this->getCommand()->parseResponse('type')); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key'); - $expected = array('prefix:key'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 5d7d9f4e..f4861d04 100644 --- a/tests/Predis/Command/ListIndexTest.php +++ b/tests/Predis/Command/ListIndexTest.php @@ -57,31 +57,6 @@ class ListIndexTest extends CommandTestCase $this->assertSame(0, $this->getCommand()->parseResponse(0)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 1); - $expected = array('prefix:key', 1); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 040e6fe2..adb3fb68 100644 --- a/tests/Predis/Command/ListInsertTest.php +++ b/tests/Predis/Command/ListInsertTest.php @@ -57,31 +57,6 @@ class ListInsertTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'before', 'value1', 'value2'); - $expected = array('prefix:key', 'before', 'value1', 'value2'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 01b5aa03..a7eac3cc 100644 --- a/tests/Predis/Command/ListLengthTest.php +++ b/tests/Predis/Command/ListLengthTest.php @@ -57,31 +57,6 @@ class ListLengthTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key'); - $expected = array('prefix:key'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 fc139971..a1cbdaf1 100644 --- a/tests/Predis/Command/ListPopFirstBlockingTest.php +++ b/tests/Predis/Command/ListPopFirstBlockingTest.php @@ -77,29 +77,4 @@ class ListPopFirstBlockingTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key1', 'key2', 'key3', 10); - $expected = array('prefix:key1', 'prefix:key2', 'prefix:key3', 10); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 69462154..da1851c9 100644 --- a/tests/Predis/Command/ListPopFirstTest.php +++ b/tests/Predis/Command/ListPopFirstTest.php @@ -57,31 +57,6 @@ class ListPopFirstTest extends CommandTestCase $this->assertSame('element', $this->getCommand()->parseResponse('element')); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key'); - $expected = array('prefix:key'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 8b8842c0..8deb113c 100644 --- a/tests/Predis/Command/ListPopLastBlockingTest.php +++ b/tests/Predis/Command/ListPopLastBlockingTest.php @@ -77,29 +77,4 @@ class ListPopLastBlockingTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key1', 'key2', 'key3', 10); - $expected = array('prefix:key1', 'prefix:key2', 'prefix:key3', 10); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 dfa00295..cd71f1ac 100644 --- a/tests/Predis/Command/ListPopLastPushHeadBlockingTest.php +++ b/tests/Predis/Command/ListPopLastPushHeadBlockingTest.php @@ -58,29 +58,4 @@ class ListPopLastPushHeadBlockingTest extends CommandTestCase { $this->assertSame('element', $this->getCommand()->parseResponse('element')); } - - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key:source', 'key:destination', 10); - $expected = array('prefix:key:source', 'prefix:key:destination', 10); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 3d08bf85..7b5726a9 100644 --- a/tests/Predis/Command/ListPopLastPushHeadTest.php +++ b/tests/Predis/Command/ListPopLastPushHeadTest.php @@ -57,31 +57,6 @@ class ListPopLastPushHeadTest extends CommandTestCase $this->assertSame('element', $this->getCommand()->parseResponse('element')); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key:source', 'key:destination'); - $expected = array('prefix:key:source', 'prefix:key:destination'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 c38f32e9..e73148be 100644 --- a/tests/Predis/Command/ListPopLastTest.php +++ b/tests/Predis/Command/ListPopLastTest.php @@ -57,31 +57,6 @@ class ListPopLastTest extends CommandTestCase $this->assertSame('element', $this->getCommand()->parseResponse('element')); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key'); - $expected = array('prefix:key'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 8674dc34..040d263b 100644 --- a/tests/Predis/Command/ListPushHeadTest.php +++ b/tests/Predis/Command/ListPushHeadTest.php @@ -71,31 +71,6 @@ class ListPushHeadTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'value1', 'value2', 'value3'); - $expected = array('prefix:key', 'value1', 'value2', 'value3'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 63929926..03a9d170 100644 --- a/tests/Predis/Command/ListPushHeadXTest.php +++ b/tests/Predis/Command/ListPushHeadXTest.php @@ -57,31 +57,6 @@ class ListPushHeadXTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'value'); - $expected = array('prefix:key', 'value'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 3c7f950b..cb7a21fe 100644 --- a/tests/Predis/Command/ListPushTailTest.php +++ b/tests/Predis/Command/ListPushTailTest.php @@ -71,31 +71,6 @@ class ListPushTailTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'value1', 'value2', 'value3'); - $expected = array('prefix:key', 'value1', 'value2', 'value3'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 d5fc678d..339528bf 100644 --- a/tests/Predis/Command/ListPushTailXTest.php +++ b/tests/Predis/Command/ListPushTailXTest.php @@ -57,31 +57,6 @@ class ListPushTailXTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'value'); - $expected = array('prefix:key', 'value'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 7aa9426f..52a1629f 100644 --- a/tests/Predis/Command/ListRangeTest.php +++ b/tests/Predis/Command/ListRangeTest.php @@ -62,31 +62,6 @@ class ListRangeTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 0, -1); - $expected = array('prefix:key', 0, -1); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 9b2a45a2..01903ceb 100644 --- a/tests/Predis/Command/ListRemoveTest.php +++ b/tests/Predis/Command/ListRemoveTest.php @@ -57,31 +57,6 @@ class ListRemoveTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 1, 'value'); - $expected = array('prefix:key', 1, 'value'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 1d127349..fbf1272d 100644 --- a/tests/Predis/Command/ListSetTest.php +++ b/tests/Predis/Command/ListSetTest.php @@ -57,31 +57,6 @@ class ListSetTest extends CommandTestCase $this->assertTrue($this->getCommand()->parseResponse(true)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 0, 'value'); - $expected = array('prefix:key', 0, 'value'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 80841ed5..eb0c0848 100644 --- a/tests/Predis/Command/ListTrimTest.php +++ b/tests/Predis/Command/ListTrimTest.php @@ -57,31 +57,6 @@ class ListTrimTest extends CommandTestCase $this->assertTrue($this->getCommand()->parseResponse(true)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 0, 1); - $expected = array('prefix:key', 0, 1); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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/PrefixHelpersTest.php b/tests/Predis/Command/PrefixHelpersTest.php deleted file mode 100644 index 5d7be8d5..00000000 --- a/tests/Predis/Command/PrefixHelpersTest.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Predis\Command; - -use PHPUnit_Framework_TestCase as StandardTestCase; - -/** - * - */ -class PrefixHelpersTest extends StandardTestCase -{ - /** - * @group disconnected - */ - public function testPrefixFirst() - { - $arguments = array('1st', '2nd', '3rd', '4th'); - $expected = array('prefix:1st', '2nd', '3rd', '4th'); - - $command = $this->getMockForAbstractClass('Predis\Command\AbstractCommand'); - $command->setRawArguments($arguments); - - PrefixHelpers::first($command, 'prefix:'); - - $this->assertSame($expected, $command->getArguments()); - } - - /** - * @group disconnected - */ - public function testPrefixAll() - { - $arguments = array('1st', '2nd', '3rd', '4th'); - $expected = array('prefix:1st', 'prefix:2nd', 'prefix:3rd', 'prefix:4th'); - - $command = $this->getMockForAbstractClass('Predis\Command\AbstractCommand'); - $command->setRawArguments($arguments); - - PrefixHelpers::all($command, 'prefix:'); - - $this->assertSame($expected, $command->getArguments()); - } - - /** - * @group disconnected - */ - public function testPrefixInterleaved() - { - $arguments = array('1st', '2nd', '3rd', '4th'); - $expected = array('prefix:1st', '2nd', 'prefix:3rd', '4th'); - - $command = $this->getMockForAbstractClass('Predis\Command\AbstractCommand'); - $command->setRawArguments($arguments); - - PrefixHelpers::interleaved($command, 'prefix:'); - - $this->assertSame($expected, $command->getArguments()); - } - - /** - * @group disconnected - */ - public function testPrefixSkipLast() - { - $arguments = array('1st', '2nd', '3rd', '4th'); - $expected = array('prefix:1st', 'prefix:2nd', 'prefix:3rd', '4th'); - - $command = $this->getMockForAbstractClass('Predis\Command\AbstractCommand'); - $command->setRawArguments($arguments); - - PrefixHelpers::skipLast($command, 'prefix:'); - - $this->assertSame($expected, $command->getArguments()); - } -} diff --git a/tests/Predis/Command/PrefixableCommandTest.php b/tests/Predis/Command/PrefixableCommandTest.php deleted file mode 100644 index ee43f05e..00000000 --- a/tests/Predis/Command/PrefixableCommandTest.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Predis\Command; - -use PHPUnit_Framework_TestCase as StandardTestCase; - -/** - * - */ -class PrefixableCommandTest extends StandardTestCase -{ - /** - * @group disconnected - */ - public function testImplementsCorrectInterface() - { - $command = $this->getMockForAbstractClass('Predis\Command\PrefixableCommand'); - - $this->assertInstanceOf('Predis\Command\PrefixableCommandInterface', $command); - $this->assertInstanceOf('Predis\Command\CommandInterface', $command); - } - - /** - * @group disconnected - */ - public function testAddPrefixToFirstArgument() - { - $command = $this->getMockForAbstractClass('Predis\Command\PrefixableCommand'); - $command->setRawArguments(array('key', 'value')); - $command->prefixKeys('prefix:'); - - $this->assertSame(array('prefix:key', 'value'), $command->getArguments()); - } - - /** - * @group disconnected - */ - public function testDoesNotBreakOnEmptyArguments() - { - $command = $this->getMockForAbstractClass('Predis\Command\PrefixableCommand'); - $command->prefixKeys('prefix:'); - - $this->assertEmpty($command->getArguments()); - } -} diff --git a/tests/Predis/Command/Processor/KeyPrefixProcessorTest.php b/tests/Predis/Command/Processor/KeyPrefixProcessorTest.php index 324ca86d..5701348f 100644 --- a/tests/Predis/Command/Processor/KeyPrefixProcessorTest.php +++ b/tests/Predis/Command/Processor/KeyPrefixProcessorTest.php @@ -11,7 +11,9 @@ namespace Predis\Command\Processor; +use stdClass; use PHPUnit_Framework_TestCase as StandardTestCase; +use Predis\Command\AbstractCommand; /** * @@ -48,33 +50,13 @@ class KeyPrefixProcessorTest extends StandardTestCase /** * @group disconnected */ - public function testProcessPrefixableCommands() + public function testProcessPrefixableCommandInterface() { $prefix = 'prefix:'; - $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'); + $command = $this->getMock('Predis\Command\PrefixableCommandInterface'); + $command->expects($this->never())->method('getId'); + $command->expects($this->once())->method('prefixKeys')->with($prefix); $processor = new KeyPrefixProcessor($prefix); @@ -91,7 +73,9 @@ class KeyPrefixProcessorTest extends StandardTestCase $expected = "$prefix$unprefixed"; $command = $this->getMock('Predis\Command\CommandInterface'); - $command->expects($this->never())->method('prefixKeys'); + $command->expects($this->once()) + ->method('getId') + ->will($this->returnValue('unknown')); $processor = new KeyPrefixProcessor($prefix); @@ -108,4 +92,729 @@ class KeyPrefixProcessorTest extends StandardTestCase $this->assertEquals($prefix, (string) $processor); } + + /** + * @group disconnected + */ + public function testPrefixFirst() + { + $arguments = array('1st', '2nd', '3rd', '4th'); + $expected = array('prefix:1st', '2nd', '3rd', '4th'); + + $command = $this->getMockForAbstractClass('Predis\Command\AbstractCommand'); + $command->setRawArguments($arguments); + + KeyPrefixProcessor::first($command, 'prefix:'); + $this->assertSame($expected, $command->getArguments()); + + // Empty arguments + $command = $this->getMockForAbstractClass('Predis\Command\AbstractCommand'); + + KeyPrefixProcessor::skipLast($command, 'prefix:'); + $this->assertEmpty($command->getArguments()); + } + + /** + * @group disconnected + */ + public function testPrefixAll() + { + $arguments = array('1st', '2nd', '3rd', '4th'); + $expected = array('prefix:1st', 'prefix:2nd', 'prefix:3rd', 'prefix:4th'); + + $command = $this->getMockForAbstractClass('Predis\Command\AbstractCommand'); + $command->setRawArguments($arguments); + + KeyPrefixProcessor::all($command, 'prefix:'); + $this->assertSame($expected, $command->getArguments()); + + // Empty arguments + $command = $this->getMockForAbstractClass('Predis\Command\AbstractCommand'); + + KeyPrefixProcessor::skipLast($command, 'prefix:'); + $this->assertEmpty($command->getArguments()); + } + + /** + * @group disconnected + */ + public function testPrefixInterleaved() + { + $arguments = array('1st', '2nd', '3rd', '4th'); + $expected = array('prefix:1st', '2nd', 'prefix:3rd', '4th'); + + $command = $this->getMockForAbstractClass('Predis\Command\AbstractCommand'); + $command->setRawArguments($arguments); + + KeyPrefixProcessor::interleaved($command, 'prefix:'); + $this->assertSame($expected, $command->getArguments()); + + // Empty arguments + $command = $this->getMockForAbstractClass('Predis\Command\AbstractCommand'); + + KeyPrefixProcessor::skipLast($command, 'prefix:'); + $this->assertEmpty($command->getArguments()); + } + + /** + * @group disconnected + */ + public function testPrefixSkipLast() + { + $arguments = array('1st', '2nd', '3rd', '4th'); + $expected = array('prefix:1st', 'prefix:2nd', 'prefix:3rd', '4th'); + + $command = $this->getMockForAbstractClass('Predis\Command\AbstractCommand'); + $command->setRawArguments($arguments); + + KeyPrefixProcessor::skipLast($command, 'prefix:'); + $this->assertSame($expected, $command->getArguments()); + + // Empty arguments + $command = $this->getMockForAbstractClass('Predis\Command\AbstractCommand'); + + KeyPrefixProcessor::skipLast($command, 'prefix:'); + $this->assertEmpty($command->getArguments()); + } + + /** + * @group disconnected + */ + public function testPrefixSort() + { + $arguments = array('key', 'BY', 'by_key_*', 'STORE', 'destination_key'); + $expected = array('prefix:key', 'BY', 'prefix:by_key_*', 'STORE', 'prefix:destination_key'); + + $command = $this->getMockForAbstractClass('Predis\Command\AbstractCommand'); + $command->setRawArguments($arguments); + + KeyPrefixProcessor::sort($command, 'prefix:'); + $this->assertSame($expected, $command->getArguments()); + + // Empty arguments + $command = $this->getMockForAbstractClass('Predis\Command\AbstractCommand'); + + KeyPrefixProcessor::sort($command, 'prefix:'); + $this->assertEmpty($command->getArguments()); + } + + /** + * @group disconnected + */ + public function testPrefixZSetStore() + { + $arguments = array('key:destination', 2, 'key1', 'key2', 'WEIGHTS', 10, 100, 'AGGREGATE', 'sum'); + $expected = array( + 'prefix:key:destination', 2, 'prefix:key1', 'prefix:key2', 'WEIGHTS', 10, 100, 'AGGREGATE', 'sum' + ); + + $command = $this->getMockForAbstractClass('Predis\Command\AbstractCommand'); + $command->setRawArguments($arguments); + + KeyPrefixProcessor::zsetStore($command, 'prefix:'); + $this->assertSame($expected, $command->getArguments()); + + // Empty arguments + $command = $this->getMockForAbstractClass('Predis\Command\AbstractCommand'); + + KeyPrefixProcessor::zsetStore($command, 'prefix:'); + $this->assertEmpty($command->getArguments()); + } + /** + * @group disconnected + */ + public function testPrefixEval() + { + $arguments = array('return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}', 2, 'foo', 'hoge', 'bar', 'piyo'); + $expected = array( + 'return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}', 2, 'prefix:foo', 'prefix:hoge', 'bar', 'piyo' + ); + + $command = $this->getMockForAbstractClass('Predis\Command\AbstractCommand'); + $command->setRawArguments($arguments); + + KeyPrefixProcessor::evalKeys($command, 'prefix:'); + $this->assertSame($expected, $command->getArguments()); + + // Empty arguments + $command = $this->getMockForAbstractClass('Predis\Command\AbstractCommand'); + + KeyPrefixProcessor::evalKeys($command, 'prefix:'); + $this->assertEmpty($command->getArguments()); + } + + /** + * @group disconnected + * @dataProvider commandArgumentsDataProvider + */ + public function testApplyPrefixToCommand($commandID, array $arguments, array $expected) + { + $processor = new KeyPrefixProcessor('prefix:'); + $command = $this->getCommandInstance($commandID, $arguments); + + $processor->process($command); + + $this->assertSame($expected, $command->getArguments()); + } + + /** + * @group disconnected + */ + public function testCanDefineNewCommandHandlers() + { + $command = $this->getCommandInstance('NEWCMD', array('key', 'value')); + + $callable = $this->getMock('stdClass', array('__invoke')); + $callable->expects($this->once()) + ->method('__invoke') + ->with($command, 'prefix:') + ->will($this->returnCallback(function ($command, $prefix) { + $command->setRawArguments(array('prefix:key', 'value')); + })); + + $processor = new KeyPrefixProcessor('prefix:'); + $processor->setCommandHandler('NEWCMD', $callable); + $processor->process($command); + + $this->assertSame(array('prefix:key', 'value'), $command->getArguments()); + } + + /** + * @group disconnected + */ + public function testCanOverrideExistingCommandHandlers() + { + $command = $this->getCommandInstance('SET', array('key', 'value')); + + $callable = $this->getMock('stdClass', array('__invoke')); + $callable->expects($this->once()) + ->method('__invoke') + ->with($command, 'prefix:') + ->will($this->returnCallback(function ($command, $prefix) { + $command->setRawArguments(array('prefix:key', 'value')); + })); + + $processor = new KeyPrefixProcessor('prefix:'); + $processor->setCommandHandler('SET', $callable); + $processor->process($command); + + $this->assertSame(array('prefix:key', 'value'), $command->getArguments()); + } + + /** + * @group disconnected + */ + public function testCanUndefineCommandHandlers() + { + $command = $this->getCommandInstance('SET', array('key', 'value')); + + $processor = new KeyPrefixProcessor('prefix:'); + $processor->setCommandHandler('SET', null); + $processor->process($command); + + $this->assertSame(array('key', 'value'), $command->getArguments()); + } + + // ******************************************************************** // + // ---- HELPER METHODS ------------------------------------------------ // + // ******************************************************************** // + + public function getCommandInstance($commandID, array $arguments) + { + $command = new DummyCommand($commandID); + $command->setRawArguments($arguments); + + return $command; + } + + /** + * Data provider for key prefixing test. + * + * @return array + */ + public function commandArgumentsDataProvider() + { + return array( + /* ---------------- Redis 1.2 ---------------- */ + array('EXISTS', + array('key'), + array('prefix:key'), + ), + array('DEL', + array('key1', 'key2', 'key3'), + array('prefix:key1', 'prefix:key2', 'prefix:key3'), + ), + array('TYPE', + array('key'), + array('prefix:key'), + ), + array('KEYS', + array('pattern'), + array('prefix:pattern'), + ), + array('RENAME', + array('key', 'newkey'), + array('prefix:key', 'prefix:newkey'), + ), + array('RENAMENX', + array('key', 'newkey'), + array('prefix:key', 'prefix:newkey'), + ), + array('EXPIRE', + array('key', 'value'), + array('prefix:key', 'value'), + ), + array('EXPIREAT', + array('key', 'value'), + array('prefix:key', 'value'), + ), + array('TTL', + array('key', 10), + array('prefix:key', 10), + ), + array('MOVE', + array('key', 'db'), + array('prefix:key', 'db'), + ), + array('SORT', + array('key'), + array('prefix:key'), + ), + array('SORT', + array('key', 'BY', 'by_key_*'), + array('prefix:key', 'BY', 'prefix:by_key_*'), + ), + array('SORT', + array('key', 'BY', 'by_key_*', 'STORE', 'destination_key'), + array('prefix:key', 'BY', 'prefix:by_key_*', 'STORE', 'prefix:destination_key'), + ), + array('SORT', + array('key', 'BY', 'by_key_*', 'GET', 'object_*', 'GET', '#', 'LIMIT', 1, 4, 'ASC', 'ALPHA', 'STORE', 'destination_key'), + array('prefix:key', 'BY', 'prefix:by_key_*', 'GET', 'prefix:object_*', 'GET', '#', 'LIMIT', 1, 4, 'ASC', 'ALPHA', 'STORE', 'prefix:destination_key'), + ), + array('DUMP', + array('key'), + array('prefix:key'), + ), + array('RESTORE', + array('key', 0, "\x00\xC0\n\x06\x00\xF8r?\xC5\xFB\xFB_("), + array('prefix:key', 0, "\x00\xC0\n\x06\x00\xF8r?\xC5\xFB\xFB_("), + ), + array('SET', + array('key', 'value'), + array('prefix:key', 'value'), + ), + array('SET', + array('key', 'value', 'EX', 10, 'NX'), + array('prefix:key', 'value', 'EX', 10, 'NX'), + ), + array('SETNX', + array('key', 'value'), + array('prefix:key', 'value'), + ), + array('MSET', + array('foo', 'bar', 'hoge', 'piyo'), + array('prefix:foo', 'bar', 'prefix:hoge', 'piyo'), + ), + array('MSETNX', + array('foo', 'bar', 'hoge', 'piyo'), + array('prefix:foo', 'bar', 'prefix:hoge', 'piyo'), + ), + array('GET', + array('key'), + array('prefix:key'), + ), + array('MGET', + array('key1', 'key2', 'key3'), + array('prefix:key1', 'prefix:key2', 'prefix:key3'), + ), + array('GETSET', + array('key', 'value'), + array('prefix:key', 'value'), + ), + array('INCR', + array('key'), + array('prefix:key'), + ), + array('INCRBY', + array('key', 5), + array('prefix:key', 5), + ), + array('DECR', + array('key'), + array('prefix:key'), + ), + array('DECRBY', + array('key', 5), + array('prefix:key', 5), + ), + array('RPUSH', + array('key', 'value1', 'value2', 'value3'), + array('prefix:key', 'value1', 'value2', 'value3'), + ), + array('LPUSH', + array('key', 'value1', 'value2', 'value3'), + array('prefix:key', 'value1', 'value2', 'value3'), + ), + array('LLEN', + array('key'), + array('prefix:key'), + ), + array('LRANGE', + array('key', 0, -1), + array('prefix:key', 0, -1), + ), + array('LTRIM', + array('key', 0, 1), + array('prefix:key', 0, 1), + ), + array('LINDEX', + array('key', 1), + array('prefix:key', 1), + ), + array('LSET', + array('key', 0, 'value'), + array('prefix:key', 0, 'value'), + ), + array('LREM', + array('key', 0, 'value'), + array('prefix:key', 0, 'value'), + ), + array('LPOP', + array('key'), + array('prefix:key'), + ), + array('RPOP', + array('key'), + array('prefix:key'), + ), + array('RPOPLPUSH', + array('key:source', 'key:destination'), + array('prefix:key:source', 'prefix:key:destination'), + ), + array('SADD', + array('key', 'member1', 'member2', 'member3'), + array('prefix:key', 'member1', 'member2', 'member3'), + ), + array('SREM', + array('key', 'member1', 'member2', 'member3'), + array('prefix:key', 'member1', 'member2', 'member3'), + ), + array('SPOP', + array('key'), + array('prefix:key'), + ), + array('SMOVE', + array('key:source', 'key:destination', 'member'), + array('prefix:key:source', 'prefix:key:destination', 'member'), + ), + array('SCARD', + array('key'), + array('prefix:key'), + ), + array('SISMEMBER', + array('key', 'member'), + array('prefix:key', 'member'), + ), + array('SINTER', + array('key1', 'key2', 'key3'), + array('prefix:key1', 'prefix:key2', 'prefix:key3'), + ), + array('SINTERSTORE', + array('key:destination', 'key1', 'key2'), + array('prefix:key:destination', 'prefix:key1', 'prefix:key2'), + ), + array('SUNION', + array('key1', 'key2', 'key3'), + array('prefix:key1', 'prefix:key2', 'prefix:key3'), + ), + array('SUNIONSTORE', + array('key:destination', 'key1', 'key2'), + array('prefix:key:destination', 'prefix:key1', 'prefix:key2'), + ), + array('SDIFF', + array('key1', 'key2', 'key3'), + array('prefix:key1', 'prefix:key2', 'prefix:key3'), + ), + array('SDIFFSTORE', + array('key:destination', 'key1', 'key2'), + array('prefix:key:destination', 'prefix:key1', 'prefix:key2'), + ), + array('SMEMBERS', + array('key'), + array('prefix:key'), + ), + array('SRANDMEMBER', + array('key', 1), + array('prefix:key', 1), + ), + array('ZADD', + array('key', 'score1', 'member1', 'score2', 'member2'), + array('prefix:key', 'score1', 'member1', 'score2', 'member2'), + ), + array('ZINCRBY', + array('key', 1.0, 'member'), + array('prefix:key', 1.0, 'member'), + ), + array('ZREM', + array('key', 'member1', 'member2', 'member3'), + array('prefix:key', 'member1', 'member2', 'member3'), + ), + array('ZRANGE', + array('key', 0, 100, 'WITHSCORES'), + array('prefix:key', 0, 100, 'WITHSCORES'), + ), + array('ZREVRANGE', + array('key', 0, 100, 'WITHSCORES'), + array('prefix:key', 0, 100, 'WITHSCORES'), + ), + array('ZRANGEBYSCORE', + array('key', 0, 100, 'LIMIT', 0, 100, 'WITHSCORES'), + array('prefix:key', 0, 100, 'LIMIT', 0, 100, 'WITHSCORES'), + ), + array('ZCARD', + array('key'), + array('prefix:key'), + ), + array('ZSCORE', + array('key', 'member'), + array('prefix:key', 'member'), + ), + array('ZREMRANGEBYSCORE', + array('key', 0, 10), + array('prefix:key', 0, 10), + ), + /* ---------------- Redis 2.0 ---------------- */ + array('SETEX', + array('key', 10, 'value'), + array('prefix:key', 10, 'value'), + ), + array('APPEND', + array('key', 'value'), + array('prefix:key', 'value'), + ), + array('SUBSTR', + array('key', 5, 10), + array('prefix:key', 5, 10), + ), + array('BLPOP', + array('key1', 'key2', 'key3', 10), + array('prefix:key1', 'prefix:key2', 'prefix:key3', 10), + ), + array('BRPOP', + array('key1', 'key2', 'key3', 10), + array('prefix:key1', 'prefix:key2', 'prefix:key3', 10), + ), + array('ZUNIONSTORE', + array('key:destination', 2, 'key1', 'key2', 'WEIGHTS', 10, 100, 'AGGREGATE', 'sum'), + array('prefix:key:destination', 2, 'prefix:key1', 'prefix:key2', 'WEIGHTS', 10, 100, 'AGGREGATE', 'sum'), + ), + array('ZINTERSTORE', + array('key:destination', 2, 'key1', 'key2', 'WEIGHTS', 10, 100, 'AGGREGATE', 'sum'), + array('prefix:key:destination', 2, 'prefix:key1', 'prefix:key2', 'WEIGHTS', 10, 100, 'AGGREGATE', 'sum'), + ), + array('ZCOUNT', + array('key', 0, 10), + array('prefix:key', 0, 10), + ), + array('ZRANK', + array('key', 'member'), + array('prefix:key', 'member'), + ), + array('ZREVRANK', + array('key', 'member'), + array('prefix:key', 'member'), + ), + array('ZREMRANGEBYRANK', + array('key', 0, 10), + array('prefix:key', 0, 10), + ), + array('HSET', + array('key', 'field', 'value'), + array('prefix:key', 'field', 'value'), + ), + array('HSETNX', + array('key', 'field', 'value'), + array('prefix:key', 'field', 'value'), + ), + array('HMSET', + array('key', 'field1', 'value1', 'field2', 'value2'), + array('prefix:key', 'field1', 'value1', 'field2', 'value2'), + ), + array('HINCRBY', + array('key', 'field', 10), + array('prefix:key', 'field', 10), + ), + array('HGET', + array('key', 'field'), + array('prefix:key', 'field'), + ), + array('HMGET', + array('key', 'field1', 'field2', 'field3'), + array('prefix:key', 'field1', 'field2', 'field3'), + ), + array('HDEL', + array('key', 'field1', 'field2', 'field3'), + array('prefix:key', 'field1', 'field2', 'field3'), + ), + array('HEXISTS', + array('key', 'field'), + array('prefix:key', 'field'), + ), + array('HLEN', + array('key'), + array('prefix:key'), + ), + array('HKEYS', + array('key'), + array('prefix:key'), + ), + array('HVALS', + array('key'), + array('prefix:key'), + ), + array('HGETALL', + array('key'), + array('prefix:key'), + ), + array('SUBSCRIBE', + array('channel:foo', 'channel:hoge'), + array('prefix:channel:foo', 'prefix:channel:hoge'), + ), + array('UNSUBSCRIBE', + array('channel:foo', 'channel:hoge'), + array('prefix:channel:foo', 'prefix:channel:hoge'), + ), + array('PSUBSCRIBE', + array('channel:foo:*', 'channel:hoge:*'), + array('prefix:channel:foo:*', 'prefix:channel:hoge:*'), + ), + array('PUNSUBSCRIBE', + array('channel:foo:*', 'channel:hoge:*'), + array('prefix:channel:foo:*', 'prefix:channel:hoge:*'), + ), + array('PUBLISH', + array('channel', 'message'), + array('prefix:channel', 'message'), + ), + /* ---------------- Redis 2.2 ---------------- */ + array('PERSIST', + array('key'), + array('prefix:key'), + ), + array('STRLEN', + array('key'), + array('prefix:key'), + ), + array('SETRANGE', + array('key', 5, 'string'), + array('prefix:key', 5, 'string'), + ), + array('GETRANGE', + array('key', 5, 10), + array('prefix:key', 5, 10), + ), + array('SETBIT', + array('key', 7, 1), + array('prefix:key', 7, 1), + ), + array('GETBIT', + array('key', 100), + array('prefix:key', 100), + ), + array('RPUSHX', + array('key', 'value'), + array('prefix:key', 'value'), + ), + array('LPUSHX', + array('key', 'value'), + array('prefix:key', 'value'), + ), + array('LINSERT', + array('key', 'before', 'value1', 'value2'), + array('prefix:key', 'before', 'value1', 'value2'), + ), + array('BRPOPLPUSH', + array('key:source', 'key:destination', 10), + array('prefix:key:source', 'prefix:key:destination', 10), + ), + array('ZREVRANGEBYSCORE', + array('key', 0, 100, 'LIMIT', 0, 100, 'WITHSCORES'), + array('prefix:key', 0, 100, 'LIMIT', 0, 100, 'WITHSCORES'), + ), + array('WATCH', + array('key1', 'key2', 'key3'), + array('prefix:key1', 'prefix:key2', 'prefix:key3'), + ), + /* ---------------- Redis 2.6 ---------------- */ + array('PTTL', + array('key', 10), + array('prefix:key', 10), + ), + array('PEXPIRE', + array('key', 1500), + array('prefix:key', 1500), + ), + array('PEXPIREAT', + array('key', 1555555555005), + array('prefix:key', 1555555555005), + ), + array('PSETEX', + array('key', 1500, 'value'), + array('prefix:key', 1500, 'value'), + ), + array('INCRBYFLOAT', + array('key', 10.5), + array('prefix:key', 10.5), + ), + array('BITOP', + array('AND', 'key:dst', 'key:01', 'key:02'), + array('AND', 'prefix:key:dst', 'prefix:key:01', 'prefix:key:02'), + ), + array('BITCOUNT', + array('key', 0, 10), + array('prefix:key', 0, 10), + ), + array('HINCRBYFLOAT', + array('key', 'field', 10.5), + array('prefix:key', 'field', 10.5), + ), + array('EVAL', + array('return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}', 2, 'foo', 'hoge', 'bar', 'piyo'), + array('return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}', 2, 'prefix:foo', 'prefix:hoge', 'bar', 'piyo'), + ), + array('EVALSHA', + array('a42059b356c875f0717db19a51f6aaca9ae659ea', 2, 'foo', 'hoge', 'bar', 'piyo'), + array('a42059b356c875f0717db19a51f6aaca9ae659ea', 2, 'prefix:foo', 'prefix:hoge', 'bar', 'piyo'), + ), + /* ---------------- Redis 2.8 ---------------- */ + array('SSCAN', + array('key', '0', 'MATCH', 'member:*', 'COUNT', 10), + array('prefix:key', '0', 'MATCH', 'member:*', 'COUNT', 10), + ), + array('ZSCAN', + array('key', '0', 'MATCH', 'member:*', 'COUNT', 10), + array('prefix:key', '0', 'MATCH', 'member:*', 'COUNT', 10), + ), + array('HSCAN', + array('key', '0', 'MATCH', 'field:*', 'COUNT', 10), + array('prefix:key', '0', 'MATCH', 'field:*', 'COUNT', 10), + ), + ); + } +} + +class DummyCommand extends AbstractCommand +{ + protected $commandID; + + public function __construct($commandID) + { + $this->commandID = $commandID; + } + + public function getId() + { + return $this->commandID; + } } diff --git a/tests/Predis/Command/PubSubPublishTest.php b/tests/Predis/Command/PubSubPublishTest.php index 45b08028..45852790 100644 --- a/tests/Predis/Command/PubSubPublishTest.php +++ b/tests/Predis/Command/PubSubPublishTest.php @@ -57,31 +57,6 @@ class PubSubPublishTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('channel', 'message'); - $expected = array('prefix:channel', 'message'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 93cc9839..8f3a3978 100644 --- a/tests/Predis/Command/PubSubSubscribeByPatternTest.php +++ b/tests/Predis/Command/PubSubSubscribeByPatternTest.php @@ -76,31 +76,6 @@ class PubSubSubscribeByPatternTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('channel:foo:*', 'channel:hoge:*'); - $expected = array('prefix:channel:foo:*', 'prefix:channel:hoge:*'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 dbe560b8..6872b510 100644 --- a/tests/Predis/Command/PubSubSubscribeTest.php +++ b/tests/Predis/Command/PubSubSubscribeTest.php @@ -76,31 +76,6 @@ class PubSubSubscribeTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array(array('channel:foo', 'channel:bar')); - $expected = array('prefix:channel:foo', 'prefix:channel:bar'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 921147de..001e1519 100644 --- a/tests/Predis/Command/PubSubUnsubscribeByPatternTest.php +++ b/tests/Predis/Command/PubSubUnsubscribeByPatternTest.php @@ -76,31 +76,6 @@ class PubSubUnsubscribeByPatternTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array(array('channel:foo:*', 'channel:bar:*')); - $expected = array('prefix:channel:foo:*', 'prefix:channel:bar:*'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 0e502d35..10fbe8dc 100644 --- a/tests/Predis/Command/PubSubUnsubscribeTest.php +++ b/tests/Predis/Command/PubSubUnsubscribeTest.php @@ -76,31 +76,6 @@ class PubSubUnsubscribeTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array(array('channel1', 'channel2', 'channel3')); - $expected = array('prefix:channel1', 'prefix:channel2', 'prefix:channel3'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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/ScriptedCommandTest.php b/tests/Predis/Command/ScriptedCommandTest.php index 7df543ad..ad4755fc 100644 --- a/tests/Predis/Command/ScriptedCommandTest.php +++ b/tests/Predis/Command/ScriptedCommandTest.php @@ -136,50 +136,6 @@ class ScriptedCommandTest extends StandardTestCase $this->assertSame(array('key1', 'key2'), $command->getKeys()); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('foo', 'hoge', 'bar', 'piyo'); - $expected = array('prefix:foo', 'prefix:hoge'); - - $command = $this->getMock('Predis\Command\ScriptedCommand', array('getScript', 'getKeysCount')); - $command->expects($this->once()) - ->method('getScript') - ->will($this->returnValue(self::LUA_SCRIPT)); - $command->expects($this->exactly(2)) - ->method('getKeysCount') - ->will($this->returnValue(2)); - $command->setArguments($arguments); - - $command->prefixKeys('prefix:'); - - $this->assertSame($expected, $command->getKeys()); - } - - /** - * @group disconnected - */ - public function testPrefixKeysWithNegativeKeysCount() - { - $arguments = array('foo', 'hoge', 'bar', 'piyo'); - $expected = array('prefix:foo', 'prefix:hoge'); - - $command = $this->getMock('Predis\Command\ScriptedCommand', array('getScript', 'getKeysCount')); - $command->expects($this->once()) - ->method('getScript') - ->will($this->returnValue(self::LUA_SCRIPT)); - $command->expects($this->exactly(2)) - ->method('getKeysCount') - ->will($this->returnValue(-2)); - $command->setArguments($arguments); - - $command->prefixKeys('prefix:'); - - $this->assertSame($expected, $command->getKeys()); - } - /** * @group disconnected */ diff --git a/tests/Predis/Command/ServerEvalSHATest.php b/tests/Predis/Command/ServerEvalSHATest.php index 401a8679..cb0df638 100644 --- a/tests/Predis/Command/ServerEvalSHATest.php +++ b/tests/Predis/Command/ServerEvalSHATest.php @@ -59,33 +59,6 @@ class ServerEvalSHATest extends CommandTestCase $this->assertSame('bar', $this->getCommand()->parseResponse('bar')); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $sha1 = 'a42059b356c875f0717db19a51f6aaca9ae659ea'; - - $arguments = array($sha1, 2, 'foo', 'hoge', 'bar', 'piyo'); - $expected = array($sha1, 2, 'prefix:foo', 'prefix:hoge', 'bar', 'piyo'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 717b1064..15ca18a9 100644 --- a/tests/Predis/Command/ServerEvalTest.php +++ b/tests/Predis/Command/ServerEvalTest.php @@ -59,33 +59,6 @@ class ServerEvalTest extends CommandTestCase $this->assertSame('bar', $this->getCommand()->parseResponse('bar')); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $lua = 'return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}'; - - $arguments = array($lua, 2, 'foo', 'hoge', 'bar', 'piyo'); - $expected = array($lua, 2, 'prefix:foo', 'prefix:hoge', 'bar', 'piyo'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 5746771f..da0b746d 100644 --- a/tests/Predis/Command/SetAddTest.php +++ b/tests/Predis/Command/SetAddTest.php @@ -71,31 +71,6 @@ class SetAddTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'member1', 'member2', 'member3'); - $expected = array('prefix:key', 'member1', 'member2', 'member3'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 e135431d..b4f03f0c 100644 --- a/tests/Predis/Command/SetCardinalityTest.php +++ b/tests/Predis/Command/SetCardinalityTest.php @@ -57,31 +57,6 @@ class SetCardinalityTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key'); - $expected = array('prefix:key'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 0c106bb3..648d7a28 100644 --- a/tests/Predis/Command/SetDifferenceStoreTest.php +++ b/tests/Predis/Command/SetDifferenceStoreTest.php @@ -71,31 +71,6 @@ class SetDifferenceStoreTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key:destination', 'key:source1', 'key:source:2'); - $expected = array('prefix:key:destination', 'prefix:key:source1', 'prefix:key:source:2'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 5e020b78..95a17185 100644 --- a/tests/Predis/Command/SetDifferenceTest.php +++ b/tests/Predis/Command/SetDifferenceTest.php @@ -76,31 +76,6 @@ class SetDifferenceTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key1', 'key2', 'key3'); - $expected = array('prefix:key1', 'prefix:key2', 'prefix:key3'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 d0f78b2d..06eb6f77 100644 --- a/tests/Predis/Command/SetIntersectionStoreTest.php +++ b/tests/Predis/Command/SetIntersectionStoreTest.php @@ -71,31 +71,6 @@ class SetIntersectionStoreTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key:destination', 'key:source1', 'key:source:2'); - $expected = array('prefix:key:destination', 'prefix:key:source1', 'prefix:key:source:2'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 32d3a697..9f6deaad 100644 --- a/tests/Predis/Command/SetIntersectionTest.php +++ b/tests/Predis/Command/SetIntersectionTest.php @@ -76,31 +76,6 @@ class SetIntersectionTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key1', 'key2', 'key3'); - $expected = array('prefix:key1', 'prefix:key2', 'prefix:key3'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 cf3b3f91..2c13f002 100644 --- a/tests/Predis/Command/SetIsMemberTest.php +++ b/tests/Predis/Command/SetIsMemberTest.php @@ -60,31 +60,6 @@ class SetIsMemberTest extends CommandTestCase $this->assertFalse($command->parseResponse(0)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'member'); - $expected = array('prefix:key', 'member'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 8c4a92ca..576b3dd2 100644 --- a/tests/Predis/Command/SetMembersTest.php +++ b/tests/Predis/Command/SetMembersTest.php @@ -62,31 +62,6 @@ class SetMembersTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key'); - $expected = array('prefix:key'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 72b1348c..56de8068 100644 --- a/tests/Predis/Command/SetMoveTest.php +++ b/tests/Predis/Command/SetMoveTest.php @@ -60,31 +60,6 @@ class SetMoveTest extends CommandTestCase $this->assertFalse($command->parseResponse(0)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key:source', 'key:destination', 'member'); - $expected = array('prefix:key:source', 'prefix:key:destination', 'member'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 e69e4157..f02f8813 100644 --- a/tests/Predis/Command/SetPopTest.php +++ b/tests/Predis/Command/SetPopTest.php @@ -57,31 +57,6 @@ class SetPopTest extends CommandTestCase $this->assertSame('member', $this->getCommand()->parseResponse('member')); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key'); - $expected = array('prefix:key'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 1919c735..f0c9b84f 100644 --- a/tests/Predis/Command/SetRandomMemberTest.php +++ b/tests/Predis/Command/SetRandomMemberTest.php @@ -57,31 +57,6 @@ class SetRandomMemberTest extends CommandTestCase $this->assertSame('member', $this->getCommand()->parseResponse('member')); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key'); - $expected = array('prefix:key'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 a6b63ffb..33c384c7 100644 --- a/tests/Predis/Command/SetRemoveTest.php +++ b/tests/Predis/Command/SetRemoveTest.php @@ -71,31 +71,6 @@ class SetRemoveTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'member1', 'member2', 'member3'); - $expected = array('prefix:key', 'member1', 'member2', 'member3'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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/SetScanTest.php b/tests/Predis/Command/SetScanTest.php index b44e3a0d..51903b56 100644 --- a/tests/Predis/Command/SetScanTest.php +++ b/tests/Predis/Command/SetScanTest.php @@ -90,31 +90,6 @@ class SetScanTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', '0', 'MATCH', 'member:*', 'COUNT', 10); - $expected = array('prefix:key', '0', 'MATCH', 'member:*', 'COUNT', 10); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 fadc0a2f..154eefb3 100644 --- a/tests/Predis/Command/SetUnionStoreTest.php +++ b/tests/Predis/Command/SetUnionStoreTest.php @@ -71,31 +71,6 @@ class SetUnionStoreTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key:destination', 'key:source1', 'key:source:2'); - $expected = array('prefix:key:destination', 'prefix:key:source1', 'prefix:key:source:2'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 bd704f7d..cad58cfc 100644 --- a/tests/Predis/Command/SetUnionTest.php +++ b/tests/Predis/Command/SetUnionTest.php @@ -76,31 +76,6 @@ class SetUnionTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key1', 'key2', 'key3'); - $expected = array('prefix:key1', 'prefix:key2', 'prefix:key3'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 7f264f02..d360de35 100644 --- a/tests/Predis/Command/StringAppendTest.php +++ b/tests/Predis/Command/StringAppendTest.php @@ -57,31 +57,6 @@ class StringAppendTest extends CommandTestCase $this->assertSame(10, $this->getCommand()->parseResponse(10)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'value'); - $expected = array('prefix:key', 'value'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 8ccdbbcf..84d8902a 100644 --- a/tests/Predis/Command/StringBitCountTest.php +++ b/tests/Predis/Command/StringBitCountTest.php @@ -62,31 +62,6 @@ class StringBitCountTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 0, 10); - $expected = array('prefix:key', 0, 10); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 8915b420..489183cf 100644 --- a/tests/Predis/Command/StringBitOpTest.php +++ b/tests/Predis/Command/StringBitOpTest.php @@ -76,31 +76,6 @@ class StringBitOpTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('AND', 'key:dst', 'key:01', 'key:02'); - $expected = array('AND', 'prefix:key:dst', 'prefix:key:01', 'prefix:key:02'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 9b921dd5..ddbfff60 100644 --- a/tests/Predis/Command/StringDecrementByTest.php +++ b/tests/Predis/Command/StringDecrementByTest.php @@ -57,31 +57,6 @@ class StringDecrementByTest extends CommandTestCase $this->assertSame(5, $this->getCommand()->parseResponse(5)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 5); - $expected = array('prefix:key', 5); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 54c6d846..f8585aa6 100644 --- a/tests/Predis/Command/StringDecrementTest.php +++ b/tests/Predis/Command/StringDecrementTest.php @@ -57,31 +57,6 @@ class StringDecrementTest extends CommandTestCase $this->assertSame(5, $this->getCommand()->parseResponse(5)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key'); - $expected = array('prefix:key'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 d9cf7459..649b7b0e 100644 --- a/tests/Predis/Command/StringGetBitTest.php +++ b/tests/Predis/Command/StringGetBitTest.php @@ -59,31 +59,6 @@ class StringGetBitTest extends CommandTestCase $this->assertSame(1, $command->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 100); - $expected = array('prefix:key', 100); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 11436db3..2712d3c9 100644 --- a/tests/Predis/Command/StringGetMultipleTest.php +++ b/tests/Predis/Command/StringGetMultipleTest.php @@ -76,31 +76,6 @@ class StringGetMultipleTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key1', 'key2', 'key3'); - $expected = array('prefix:key1', 'prefix:key2', 'prefix:key3'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 4c826065..e97d6623 100644 --- a/tests/Predis/Command/StringGetRangeTest.php +++ b/tests/Predis/Command/StringGetRangeTest.php @@ -57,31 +57,6 @@ class StringGetRangeTest extends CommandTestCase $this->assertSame('substring',$this->getCommand()->parseResponse('substring')); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 5, 10); - $expected = array('prefix:key', 5, 10); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 a6228409..9753c517 100644 --- a/tests/Predis/Command/StringGetSetTest.php +++ b/tests/Predis/Command/StringGetSetTest.php @@ -57,31 +57,6 @@ class StringGetSetTest extends CommandTestCase $this->assertSame('value', $this->getCommand()->parseResponse('value')); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'value'); - $expected = array('prefix:key', 'value'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 b626c6d4..70bcfe70 100644 --- a/tests/Predis/Command/StringGetTest.php +++ b/tests/Predis/Command/StringGetTest.php @@ -57,31 +57,6 @@ class StringGetTest extends CommandTestCase $this->assertSame('bar', $this->getCommand()->parseResponse('bar')); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key'); - $expected = array('prefix:key'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 041d798f..3f084611 100644 --- a/tests/Predis/Command/StringIncrementByFloatTest.php +++ b/tests/Predis/Command/StringIncrementByFloatTest.php @@ -57,31 +57,6 @@ class StringIncrementByFloatTest extends CommandTestCase $this->assertSame(5.0, $this->getCommand()->parseResponse(5.0)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 5.0); - $expected = array('prefix:key', 5.0); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 5fec96c6..c34baeba 100644 --- a/tests/Predis/Command/StringIncrementByTest.php +++ b/tests/Predis/Command/StringIncrementByTest.php @@ -57,31 +57,6 @@ class StringIncrementByTest extends CommandTestCase $this->assertSame(5, $this->getCommand()->parseResponse(5)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 5); - $expected = array('prefix:key', 5); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 386219b3..56e95053 100644 --- a/tests/Predis/Command/StringIncrementTest.php +++ b/tests/Predis/Command/StringIncrementTest.php @@ -57,31 +57,6 @@ class StringIncrementTest extends CommandTestCase $this->assertSame(5, $this->getCommand()->parseResponse(5)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key'); - $expected = array('prefix:key'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 a92655b9..d52662be 100644 --- a/tests/Predis/Command/StringPreciseSetExpireTest.php +++ b/tests/Predis/Command/StringPreciseSetExpireTest.php @@ -57,31 +57,6 @@ class StringPreciseSetExpireTest extends CommandTestCase $this->assertTrue($this->getCommand()->parseResponse(true)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 10, 'hello'); - $expected = array('prefix:key', 10, 'hello'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 3089999d..0d4db879 100644 --- a/tests/Predis/Command/StringSetBitTest.php +++ b/tests/Predis/Command/StringSetBitTest.php @@ -59,31 +59,6 @@ class StringSetBitTest extends CommandTestCase $this->assertSame(1, $command->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 7, 1); - $expected = array('prefix:key', 7, 1); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 4a86e72d..347d2a98 100644 --- a/tests/Predis/Command/StringSetExpireTest.php +++ b/tests/Predis/Command/StringSetExpireTest.php @@ -57,31 +57,6 @@ class StringSetExpireTest extends CommandTestCase $this->assertTrue($this->getCommand()->parseResponse(true)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 10, 'hello'); - $expected = array('prefix:key', 10, 'hello'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 827f57e2..d768527f 100644 --- a/tests/Predis/Command/StringSetMultiplePreserveTest.php +++ b/tests/Predis/Command/StringSetMultiplePreserveTest.php @@ -71,31 +71,6 @@ class StringSetMultiplePreserveTest extends CommandTestCase $this->assertSame(true, $this->getCommand()->parseResponse(true)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('foo', 'bar', 'hoge', 'piyo'); - $expected = array('prefix:foo', 'bar', 'prefix:hoge', 'piyo'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 9d1ea3ea..b720ee76 100644 --- a/tests/Predis/Command/StringSetMultipleTest.php +++ b/tests/Predis/Command/StringSetMultipleTest.php @@ -71,31 +71,6 @@ class StringSetMultipleTest extends CommandTestCase $this->assertSame(true, $this->getCommand()->parseResponse(true)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('foo', 'bar', 'hoge', 'piyo'); - $expected = array('prefix:foo', 'bar', 'prefix:hoge', 'piyo'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 4d6d22d5..a824db10 100644 --- a/tests/Predis/Command/StringSetRangeTest.php +++ b/tests/Predis/Command/StringSetRangeTest.php @@ -57,31 +57,6 @@ class StringSetRangeTest extends CommandTestCase $this->assertSame(10, $this->getCommand()->parseResponse(10)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 5, 'range'); - $expected = array('prefix:key', 5, 'range'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 80c1dc63..8599c385 100644 --- a/tests/Predis/Command/StringSetTest.php +++ b/tests/Predis/Command/StringSetTest.php @@ -57,31 +57,6 @@ class StringSetTest extends CommandTestCase $this->assertTrue($this->getCommand()->parseResponse(true)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'value'); - $expected = array('prefix:key', 'value'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 ed7ed2ae..5763aa13 100644 --- a/tests/Predis/Command/StringStrlenTest.php +++ b/tests/Predis/Command/StringStrlenTest.php @@ -57,31 +57,6 @@ class StringStrlenTest extends CommandTestCase $this->assertSame(4, $this->getCommand()->parseResponse(4)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key'); - $expected = array('prefix:key'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 cdd0106b..38157ae1 100644 --- a/tests/Predis/Command/StringSubstrTest.php +++ b/tests/Predis/Command/StringSubstrTest.php @@ -60,29 +60,4 @@ class StringSubstrTest extends CommandTestCase { $this->assertSame('substring',$this->getCommand()->parseResponse('substring')); } - - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 5, 10); - $expected = array('prefix:key', 5, 10); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 ec4f965d..eebde3a7 100644 --- a/tests/Predis/Command/TransactionWatchTest.php +++ b/tests/Predis/Command/TransactionWatchTest.php @@ -71,31 +71,6 @@ class TransactionWatchTest extends CommandTestCase $this->assertTrue($this->getCommand()->parseResponse(true)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key1', 'key2', 'key3'); - $expected = array('prefix:key1', 'prefix:key2', 'prefix:key3'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 4cbac71e..d3166ad1 100644 --- a/tests/Predis/Command/ZSetAddTest.php +++ b/tests/Predis/Command/ZSetAddTest.php @@ -71,31 +71,6 @@ class ZSetAddTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'score1', 'member1', 'score2', 'member2'); - $expected = array('prefix:key', 'score1', 'member1', 'score2', 'member2'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 8ae66487..a749afb1 100644 --- a/tests/Predis/Command/ZSetCardinalityTest.php +++ b/tests/Predis/Command/ZSetCardinalityTest.php @@ -57,31 +57,6 @@ class ZSetCardinalityTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key'); - $expected = array('prefix:key'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 fc25cfd5..b5fcd659 100644 --- a/tests/Predis/Command/ZSetCountTest.php +++ b/tests/Predis/Command/ZSetCountTest.php @@ -57,31 +57,6 @@ class ZSetCountTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 0, 10); - $expected = array('prefix:key', 0, 10); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 80a310f8..cd7bedb7 100644 --- a/tests/Predis/Command/ZSetIncrementByTest.php +++ b/tests/Predis/Command/ZSetIncrementByTest.php @@ -57,31 +57,6 @@ class ZSetIncrementByTest extends CommandTestCase $this->assertSame('1', $this->getCommand()->parseResponse('1')); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 1.0, 'member'); - $expected = array('prefix:key', 1.0, 'member'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 de8da8ff..369d12cf 100644 --- a/tests/Predis/Command/ZSetIntersectionStoreTest.php +++ b/tests/Predis/Command/ZSetIntersectionStoreTest.php @@ -85,39 +85,6 @@ class ZSetIntersectionStoreTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $modifiers = array( - 'aggregate' => 'sum', - 'weights' => array(10, 100), - ); - $arguments = array('zset:destination', 2, 'zset1', 'zset2', $modifiers); - - $expected = array( - 'prefix:zset:destination', 2, 'prefix:zset1', 'prefix:zset2', 'WEIGHTS', 10, 100, 'AGGREGATE', 'sum' - ); - - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 82caed4a..a7a8ebce 100644 --- a/tests/Predis/Command/ZSetRangeByScoreTest.php +++ b/tests/Predis/Command/ZSetRangeByScoreTest.php @@ -108,36 +108,6 @@ class ZSetRangeByScoreTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $modifiers = array( - 'withscores' => true, - 'limit' => array(0, 100), - ); - - $arguments = array('zset', 0, 100, $modifiers); - $expected = array('prefix:zset', 0, 100, 'LIMIT', 0, 100, 'WITHSCORES'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 7b629f8a..857d9cbd 100644 --- a/tests/Predis/Command/ZSetRangeTest.php +++ b/tests/Predis/Command/ZSetRangeTest.php @@ -89,31 +89,6 @@ class ZSetRangeTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('zset', 0, 100, array('withscores' => true)); - $expected = array('prefix:zset', 0, 100, 'WITHSCORES'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 853a81f1..36a1b88c 100644 --- a/tests/Predis/Command/ZSetRankTest.php +++ b/tests/Predis/Command/ZSetRankTest.php @@ -57,31 +57,6 @@ class ZSetRankTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'member'); - $expected = array('prefix:key', 'member'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 5ebb2b4e..bfc5509a 100644 --- a/tests/Predis/Command/ZSetRemoveRangeByRankTest.php +++ b/tests/Predis/Command/ZSetRemoveRangeByRankTest.php @@ -57,31 +57,6 @@ class ZSetRemoveRangeByRankTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 0, 10); - $expected = array('prefix:key', 0, 10); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 834f7d02..f272ad01 100644 --- a/tests/Predis/Command/ZSetRemoveRangeByScoreTest.php +++ b/tests/Predis/Command/ZSetRemoveRangeByScoreTest.php @@ -57,31 +57,6 @@ class ZSetRemoveRangeByScoreTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 0, 10); - $expected = array('prefix:key', 0, 10); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 16ab9a5d..3c5650c4 100644 --- a/tests/Predis/Command/ZSetRemoveTest.php +++ b/tests/Predis/Command/ZSetRemoveTest.php @@ -57,31 +57,6 @@ class ZSetRemoveTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('zset', 'member1', 'member2', 'member3'); - $expected = array('prefix:zset', 'member1', 'member2', 'member3'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 49367bd0..c4078544 100644 --- a/tests/Predis/Command/ZSetReverseRangeByScoreTest.php +++ b/tests/Predis/Command/ZSetReverseRangeByScoreTest.php @@ -108,36 +108,6 @@ class ZSetReverseRangeByScoreTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $modifiers = array( - 'withscores' => true, - 'limit' => array(0, 100), - ); - - $arguments = array('zset', 0, 100, $modifiers); - $expected = array('prefix:zset', 0, 100, 'LIMIT', 0, 100, 'WITHSCORES'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 48dc5593..b2a08344 100644 --- a/tests/Predis/Command/ZSetReverseRangeTest.php +++ b/tests/Predis/Command/ZSetReverseRangeTest.php @@ -89,31 +89,6 @@ class ZSetReverseRangeTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('zset', 0, 100, array('withscores' => true)); - $expected = array('prefix:zset', 0, 100, 'WITHSCORES'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 d80b543e..489a2f10 100644 --- a/tests/Predis/Command/ZSetReverseRankTest.php +++ b/tests/Predis/Command/ZSetReverseRankTest.php @@ -57,31 +57,6 @@ class ZSetReverseRankTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'member'); - $expected = array('prefix:key', 'member'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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/ZSetScanTest.php b/tests/Predis/Command/ZSetScanTest.php index 92b4e96a..95077110 100644 --- a/tests/Predis/Command/ZSetScanTest.php +++ b/tests/Predis/Command/ZSetScanTest.php @@ -90,31 +90,6 @@ class ZSetScanTest extends CommandTestCase $this->assertSame($expected, $command->parseResponse($raw)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', '0', 'MATCH', 'member:*', 'COUNT', 10); - $expected = array('prefix:key', '0', 'MATCH', 'member:*', 'COUNT', 10); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 e80af3a4..cffc9f46 100644 --- a/tests/Predis/Command/ZSetScoreTest.php +++ b/tests/Predis/Command/ZSetScoreTest.php @@ -57,31 +57,6 @@ class ZSetScoreTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $arguments = array('key', 'member'); - $expected = array('prefix:key', 'member'); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $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 56aaef7e..d4210773 100644 --- a/tests/Predis/Command/ZSetUnionStoreTest.php +++ b/tests/Predis/Command/ZSetUnionStoreTest.php @@ -85,38 +85,6 @@ class ZSetUnionStoreTest extends CommandTestCase $this->assertSame(1, $this->getCommand()->parseResponse(1)); } - /** - * @group disconnected - */ - public function testPrefixKeys() - { - $modifiers = array( - 'aggregate' => 'sum', - 'weights' => array(10, 100), - ); - $arguments = array('zset:destination', 2, 'zset1', 'zset2', $modifiers); - - $expected = array( - 'prefix:zset:destination', 2, 'prefix:zset1', 'prefix:zset2', 'WEIGHTS', 10, 100, 'AGGREGATE', 'sum' - ); - - $command = $this->getCommandWithArgumentsArray($arguments); - $command->prefixKeys('prefix:'); - - $this->assertSame($expected, $command->getArguments()); - } - - /** - * @group disconnected - */ - public function testPrefixKeysIgnoredOnEmptyArguments() - { - $command = $this->getCommand(); - $command->prefixKeys('prefix:'); - - $this->assertSame(array(), $command->getArguments()); - } - /** * @group connected */