Browse Source

Switch from server profiles to commands factory.

This change reduces some unnecessary complexity in the library, Redis
commands do not change much after all. Developers can still implement
their own commands factory, inject new commands or override existing
ones. The "profile" client options has been renamed to "commands" and
it accepts instances of Predis\Command\FactoryInterface.

The test suite checks at runtime the version of the running instance
of Redis for integration tests to adapt itself automatically.
Daniele Alessandri 8 years ago
parent
commit
62b421f20e
100 changed files with 888 additions and 2782 deletions
  1. 7 0
      CHANGELOG.md
  2. 15 19
      README.md
  3. 8 9
      examples/lua_scripting_abstraction.php
  4. 2 3
      examples/redis_collections_iterators.php
  5. 7 7
      examples/replication_complex.php
  6. 0 1
      phpunit.xml.dist
  7. 0 1
      phpunit.xml.travisci
  8. 5 5
      src/Client.php
  9. 4 4
      src/ClientInterface.php
  10. 2 2
      src/Collection/Iterator/CursorBasedIterator.php
  11. 2 2
      src/Collection/Iterator/ListKey.php
  12. 10 18
      src/Command/Factory.php
  13. 9 8
      src/Command/FactoryInterface.php
  14. 43 28
      src/Command/Redis/ServerInfo.php
  15. 0 58
      src/Command/Redis/ServerInfoV26x.php
  16. 4 4
      src/Command/RedisFactory.php
  17. 14 19
      src/Configuration/CommandsOption.php
  18. 1 1
      src/Configuration/Options.php
  19. 2 1
      src/Configuration/OptionsInterface.php
  20. 2 2
      src/Monitor/Consumer.php
  21. 6 6
      src/Pipeline/Atomic.php
  22. 0 101
      src/Profile/Factory.php
  23. 0 38
      src/Profile/RedisUnstable.php
  24. 0 173
      src/Profile/RedisVersion200.php
  25. 0 202
      src/Profile/RedisVersion220.php
  26. 0 207
      src/Profile/RedisVersion240.php
  27. 0 235
      src/Profile/RedisVersion260.php
  28. 0 267
      src/Profile/RedisVersion280.php
  29. 0 270
      src/Profile/RedisVersion300.php
  30. 2 2
      src/PubSub/Consumer.php
  31. 6 6
      src/Transaction/MultiExec.php
  32. 3 4
      tests/PHPUnit/PredisCommandTestCase.php
  33. 46 46
      tests/PHPUnit/PredisConnectionTestCase.php
  34. 0 282
      tests/PHPUnit/PredisProfileTestCase.php
  35. 6 23
      tests/PHPUnit/PredisTestCase.php
  36. 28 29
      tests/Predis/ClientTest.php
  37. 29 32
      tests/Predis/Cluster/PredisStrategyTest.php
  38. 31 32
      tests/Predis/Cluster/RedisStrategyTest.php
  39. 48 45
      tests/Predis/Collection/Iterator/HashKeyTest.php
  40. 45 42
      tests/Predis/Collection/Iterator/KeyspaceTest.php
  41. 42 23
      tests/Predis/Collection/Iterator/ListKeyTest.php
  42. 45 42
      tests/Predis/Collection/Iterator/SetKeyTest.php
  43. 48 45
      tests/Predis/Collection/Iterator/SortedSetKeyTest.php
  44. 2 0
      tests/Predis/Command/Redis/HashDeleteTest.php
  45. 2 0
      tests/Predis/Command/Redis/HashExistsTest.php
  46. 2 0
      tests/Predis/Command/Redis/HashGetAllTest.php
  47. 2 0
      tests/Predis/Command/Redis/HashGetMultipleTest.php
  48. 2 0
      tests/Predis/Command/Redis/HashGetTest.php
  49. 4 0
      tests/Predis/Command/Redis/HashIncrementByFloatTest.php
  50. 4 0
      tests/Predis/Command/Redis/HashIncrementByTest.php
  51. 2 0
      tests/Predis/Command/Redis/HashKeysTest.php
  52. 2 0
      tests/Predis/Command/Redis/HashLengthTest.php
  53. 3 0
      tests/Predis/Command/Redis/HashScanTest.php
  54. 4 1
      tests/Predis/Command/Redis/HashSetMultipleTest.php
  55. 2 0
      tests/Predis/Command/Redis/HashSetPreserveTest.php
  56. 2 0
      tests/Predis/Command/Redis/HashSetTest.php
  57. 2 0
      tests/Predis/Command/Redis/HashValuesTest.php
  58. 2 0
      tests/Predis/Command/Redis/KeyMigrateTest.php
  59. 3 0
      tests/Predis/Command/Redis/KeyPersistTest.php
  60. 2 0
      tests/Predis/Command/Redis/KeyPreciseExpireAtTest.php
  61. 4 0
      tests/Predis/Command/Redis/KeyPreciseExpireTest.php
  62. 3 0
      tests/Predis/Command/Redis/KeyPreciseTimeToLiveTest.php
  63. 3 0
      tests/Predis/Command/Redis/KeyScanTest.php
  64. 3 0
      tests/Predis/Command/Redis/ListLengthTest.php
  65. 3 0
      tests/Predis/Command/Redis/ListPushHeadXTest.php
  66. 3 0
      tests/Predis/Command/Redis/ListPushTailXTest.php
  67. 1 0
      tests/Predis/Command/Redis/PubSubPublishTest.php
  68. 8 1
      tests/Predis/Command/Redis/PubSubSubscribeByPatternTest.php
  69. 8 1
      tests/Predis/Command/Redis/PubSubSubscribeTest.php
  70. 4 0
      tests/Predis/Command/Redis/PubSubUnsubscribeByPatternTest.php
  71. 4 0
      tests/Predis/Command/Redis/PubSubUnsubscribeTest.php
  72. 3 0
      tests/Predis/Command/Redis/ServerClientTest.php
  73. 7 0
      tests/Predis/Command/Redis/ServerConfigTest.php
  74. 3 0
      tests/Predis/Command/Redis/ServerEvalSHATest.php
  75. 3 0
      tests/Predis/Command/Redis/ServerEvalTest.php
  76. 160 121
      tests/Predis/Command/Redis/ServerInfoTest.php
  77. 0 313
      tests/Predis/Command/Redis/ServerInfoV26xTest.php
  78. 1 1
      tests/Predis/Command/Redis/ServerMonitorTest.php
  79. 5 0
      tests/Predis/Command/Redis/ServerObjectTest.php
  80. 4 0
      tests/Predis/Command/Redis/ServerScriptTest.php
  81. 3 0
      tests/Predis/Command/Redis/ServerSlowlogTest.php
  82. 1 0
      tests/Predis/Command/Redis/ServerTimeTest.php
  83. 11 0
      tests/Predis/Command/Redis/SetAddTest.php
  84. 16 0
      tests/Predis/Command/Redis/SetRemoveTest.php
  85. 3 0
      tests/Predis/Command/Redis/SetScanTest.php
  86. 3 0
      tests/Predis/Command/Redis/StringAppendTest.php
  87. 2 0
      tests/Predis/Command/Redis/StringBitCountTest.php
  88. 8 0
      tests/Predis/Command/Redis/StringBitOpTest.php
  89. 4 0
      tests/Predis/Command/Redis/StringGetBitTest.php
  90. 3 0
      tests/Predis/Command/Redis/StringGetRangeTest.php
  91. 5 0
      tests/Predis/Command/Redis/StringIncrementByFloatTest.php
  92. 5 0
      tests/Predis/Command/Redis/StringPreciseSetExpireTest.php
  93. 6 0
      tests/Predis/Command/Redis/StringSetBitTest.php
  94. 5 0
      tests/Predis/Command/Redis/StringSetExpireTest.php
  95. 5 0
      tests/Predis/Command/Redis/StringSetRangeTest.php
  96. 3 0
      tests/Predis/Command/Redis/StringStrlenTest.php
  97. 2 0
      tests/Predis/Command/Redis/TransactionDiscardTest.php
  98. 2 0
      tests/Predis/Command/Redis/TransactionUnwatchTest.php
  99. 3 0
      tests/Predis/Command/Redis/TransactionWatchTest.php
  100. 4 0
      tests/Predis/Command/Redis/ZSetCountTest.php

+ 7 - 0
CHANGELOG.md

@@ -1,6 +1,13 @@
 v2.0.0 (201x-xx-xx)
 ================================================================================
 
+- The concept of server profiles is gone, the library now uses a single command
+  factory to create instances of commands classes. The `profile` option has been
+  replaced by the `commands` option accepting `Predis\Command\FactoryInterface`
+  to customize the underlying command factory. The default command factory class
+  used by Predis is `Predis\Command\RedisFactory` and it still allows developers
+  to define or override commands with their own implementations.
+
 - Classes for Redis commands have been moved into the new `Predis\Command\Redis`
   namespace.
 

+ 15 - 19
README.md

@@ -20,7 +20,7 @@ More details about this project can be found on the [frequently asked questions]
 
 ## Main features ##
 
-- Support for different versions of Redis (from __2.0__ to __3.2__) using profiles.
+- Support for Redis from __2.0__ to __3.2__.
 - Support for clustering using client-side sharding and pluggable keyspace distributors.
 - Support for [redis-cluster](http://redis.io/topics/cluster-tutorial) (Redis >= 3.0).
 - Support for master-slave replication setups and [redis-sentinel](http://redis.io/topics/sentinel).
@@ -33,7 +33,7 @@ More details about this project can be found on the [frequently asked questions]
 - Connections can be established via TCP/IP (also TLS/SSL-encrypted) or UNIX domain sockets.
 - Support for [Webdis](http://webd.is) (requires both `ext-curl` and `ext-phpiredis`).
 - Support for custom connection classes for providing different network or protocol backends.
-- Flexible system for defining custom commands and profiles and override the default ones.
+- Flexible system for defining custom commands and override the default ones.
 
 
 ## How to _install_ and use Predis ##
@@ -148,13 +148,12 @@ Many aspects and behaviors of the client can be configured by passing specific c
 second argument of `Predis\Client::__construct()`:
 
 ```php
-$client = new Predis\Client($parameters, ['profile' => '2.8', 'prefix' => 'sample:']);
+$client = new Predis\Client($parameters, ['prefix' => 'sample:']);
 ```
 
 Options are managed using a mini DI-alike container and their values can be lazily initialized only
 when needed. The client options supported by default in Predis are:
 
-  - `profile`: specifies the profile to use to match a specific version of Redis.
   - `prefix`: prefix string automatically applied to keys found in commands.
   - `exceptions`: whether the client should throw or return responses upon Redis errors.
   - `connections`: list of connection backends or a connection factory instance.
@@ -162,6 +161,7 @@ when needed. The client options supported by default in Predis are:
   - `replication`: specifies a replication backend (`TRUE`, `sentinel` or callable object).
   - `aggregate`: overrides `cluster` and `replication` to provide a custom connections aggregator.
   - `parameters`: list of default connection parameters for aggregate connections.
+  - `commands`: specifies a command factory instance to use through the library.
 
 Users can also provide custom options with values or callable objects (for lazy initialization) that
 are stored in the options container for later use through the library.
@@ -324,7 +324,7 @@ of a transaction using CAS you can see [the following example](examples/transact
 While we try to update Predis to stay up to date with all the commands available in Redis, you might
 prefer to stick with an old version of the library or provide a different way to filter arguments or
 parse responses for specific commands. To achieve that, Predis provides the ability to implement new
-command classes to define or override commands in the default server profiles used by the client:
+command classes to define or override commands in the default command factory used by the client:
 
 ```php
 // Define a new command by extending Predis\Command\Command:
@@ -336,9 +336,9 @@ class BrandNewRedisCommand extends Predis\Command\Command
     }
 }
 
-// Inject your command in the current profile:
+// Inject your command in the current command factory:
 $client = new Predis\Client();
-$client->getProfile()->defineCommand('newcmd', 'BrandNewRedisCommand');
+$client->getCommandFactory()->defineCommand('newcmd', 'BrandNewRedisCommand');
 
 $response = $client->newcmd();
 ```
@@ -357,7 +357,7 @@ $response = $client->executeRaw(['SET', 'foo', 'bar']);
 While it is possible to leverage [Lua scripting](http://redis.io/commands/eval) on Redis 2.6+ using
 directly [`EVAL`](http://redis.io/commands/eval) and [`EVALSHA`](http://redis.io/commands/evalsha),
 Predis offers script commands as an higher level abstraction built upon them to make things simple.
-Script commands can be registered in the server profile used by the client and are accessible as if
+Script commands can be registered in the command factory used by the client and are accessible as if
 they were plain Redis commands, but they define Lua scripts that get transmitted to the server for
 remote execution. Internally they use [`EVALSHA`](http://redis.io/commands/evalsha) by default and
 identify a script by its SHA1 hash to save bandwidth, but [`EVAL`](http://redis.io/commands/eval)
@@ -383,9 +383,9 @@ LUA;
     }
 }
 
-// Inject the script command in the current profile:
+// Inject the script command in the current command factory:
 $client = new Predis\Client();
-$client->getProfile()->defineCommand('lpushrand', 'ListPushRandomValue');
+$client->getCommandFactory()->defineCommand('lpushrand', 'ListPushRandomValue');
 
 $response = $client->lpushrand('random_values', $seed = mt_rand());
 ```
@@ -443,15 +443,11 @@ stay consistent while working on the project.
 __ATTENTION__: Do not ever run the test suite shipped with Predis against instances of Redis running
 in production environments or containing data you are interested in!
 
-Predis has a comprehensive test suite covering every aspect of the library. This test suite performs
-integration tests against a running instance of Redis (>= 2.4.0 is required) to verify the correct
-behavior of the implementation of each command and automatically skips commands not defined in the
-specified Redis profile. If you do not have Redis up and running, integration tests can be disabled.
-By default the test suite is configured to execute integration tests using the profile for Redis 3.2
-(which is the current stable version of Redis) but can optionally target a Redis instance built from
-the `unstable` branch by modifying `phpunit.xml` and setting `REDIS_SERVER_VERSION` to `dev` so that
-the development server profile will be used. You can refer to [the tests README](tests/README.md)
-for more detailed information about testing Predis.
+Predis has a comprehensive test suite covering every aspect of the library and that can optionally
+perform integration tests against a running instance of Redis (required >= 2.4.0 in order to verify
+the correct behavior of the implementation of each command. Integration tests for unsupported Redis
+commands are automatically skipped. If you do not have Redis up and running, integration tests can
+be disabled. See [the tests README](tests/README.md) for more details about testing this library.
 
 Predis uses Travis CI for continuous integration and the history for past and current builds can be
 found [on its project page](http://travis-ci.org/nrk/predis).

+ 8 - 9
examples/lua_scripting_abstraction.php

@@ -13,11 +13,10 @@ require __DIR__.'/shared.php';
 
 // This example will not work with versions of Redis < 2.6.
 //
-// Additionally to the EVAL command defined in the current development profile,
-// the Predis\Command\ScriptCommand class can be used to build an higher level
-// abstraction for "scriptable" commands so that they will appear just like any
-// other command on the client-side. This is a quick example used to implement
-// INCREX.
+// Additionally to the EVAL command, the Predis\Command\ScriptCommand class can
+// be used to leverage an higher level abstraction for Lua scripting that makes
+// scripts appear just like any other command on the client-side. This is basic
+// example on how a script-based INCREX command can be defined:
 
 use Predis\Command\ScriptCommand;
 
@@ -50,11 +49,11 @@ LUA;
 }
 
 $client = new Predis\Client($single_server, array(
-    'profile' => function ($options) {
-        $profile = $options->getDefault('profile');
-        $profile->defineCommand('increxby', 'IncrementExistingKeysBy');
+    'commands' => function ($options) {
+        $commands = $options->getDefault('commands');
+        $commands->defineCommand('increxby', 'IncrementExistingKeysBy');
 
-        return $profile;
+        return $commands;
     },
 ));
 

+ 2 - 3
examples/redis_collections_iterators.php

@@ -13,7 +13,7 @@ require __DIR__.'/shared.php';
 
 use Predis\Collection\Iterator;
 
-// Starting from Redis 2.8, clients can iterate incrementally over collections
+// Starting with Redis 2.8, clients can iterate incrementally over collections
 // without blocking the server like it happens when a command such as KEYS is
 // executed on a Redis instance storing millions of keys. These commands are:
 //
@@ -29,8 +29,7 @@ use Predis\Collection\Iterator;
 // See http://redis.io/commands/scan for more details.
 //
 
-// Create a client using `2.8` as a server profile (needs Redis 2.8!)
-$client = new Predis\Client($single_server, array('profile' => '2.8'));
+$client = new Predis\Client($single_server);
 
 // Prepare some keys for our example
 $client->del('predis:set', 'predis:zset', 'predis:hash');

+ 7 - 7
examples/replication_complex.php

@@ -14,9 +14,9 @@ require __DIR__.'/shared.php';
 // Predis allows to set Lua scripts as read-only operations for replication.
 // This works for both EVAL and EVALSHA and also for the client-side abstraction
 // built upon them (Predis\Command\ScriptCommand). This example shows a slightly
-// more complex configuration that injects a new script command in the server
-// profile used by the new client instance and marks it marks it as a read-only
-// operation for replication so that it will be executed on slaves.
+// more complex configuration that injects a new script command in the command
+// factory used by the client and marks it as a read-only operation so that it
+// will be executed on slaves.
 
 use Predis\Command\ScriptCommand;
 use Predis\Connection\Aggregate\MasterSlaveReplication;
@@ -52,11 +52,11 @@ $parameters = array(
 );
 
 $options = array(
-    'profile' => function ($options, $option) {
-        $profile = $options->getDefault($option);
-        $profile->defineCommand('hmgetall', 'HashMultipleGetAll');
+    'commands' => function ($options) {
+        $commands = $options->getDefault('commands');
+        $commands->defineCommand('hmgetall', 'HashMultipleGetAll');
 
-        return $profile;
+        return $commands;
     },
     'replication' => function () {
         $strategy = new ReplicationStrategy();

+ 0 - 1
phpunit.xml.dist

@@ -38,7 +38,6 @@
 
     <php>
         <!-- Redis -->
-        <const name="REDIS_SERVER_VERSION" value="3.2" />
         <const name="REDIS_SERVER_HOST" value="127.0.0.1" />
         <const name="REDIS_SERVER_PORT" value="6379" />
         <const name="REDIS_SERVER_DBNUM" value="15" />

+ 0 - 1
phpunit.xml.travisci

@@ -42,7 +42,6 @@
 
     <php>
         <!-- Redis -->
-        <const name="REDIS_SERVER_VERSION" value="3.2" />
         <const name="REDIS_SERVER_HOST" value="127.0.0.1" />
         <const name="REDIS_SERVER_PORT" value="6379" />
         <const name="REDIS_SERVER_DBNUM" value="15" />

+ 5 - 5
src/Client.php

@@ -44,7 +44,7 @@ class Client implements ClientInterface, \IteratorAggregate
 
     protected $connection;
     protected $options;
-    private $profile;
+    private $commands;
 
     /**
      * @param mixed $parameters Connection parameters for one or more servers.
@@ -54,7 +54,7 @@ class Client implements ClientInterface, \IteratorAggregate
     {
         $this->options = $this->createOptions($options ?: array());
         $this->connection = $this->createConnection($parameters ?: array());
-        $this->profile = $this->options->profile;
+        $this->commands = $this->options->commands;
     }
 
     /**
@@ -174,9 +174,9 @@ class Client implements ClientInterface, \IteratorAggregate
     /**
      * {@inheritdoc}
      */
-    public function getProfile()
+    public function getCommandFactory()
     {
-        return $this->profile;
+        return $this->commands;
     }
 
     /**
@@ -320,7 +320,7 @@ class Client implements ClientInterface, \IteratorAggregate
      */
     public function createCommand($commandID, $arguments = array())
     {
-        return $this->profile->createCommand($commandID, $arguments);
+        return $this->commands->createCommand($commandID, $arguments);
     }
 
     /**

+ 4 - 4
src/ClientInterface.php

@@ -12,9 +12,9 @@
 namespace Predis;
 
 use Predis\Command\CommandInterface;
+use Predis\Command\FactoryInterface;
 use Predis\Configuration\OptionsInterface;
 use Predis\Connection\ConnectionInterface;
-use Predis\Profile\ProfileInterface;
 
 /**
  * Interface defining a client able to execute commands against Redis.
@@ -177,11 +177,11 @@ use Predis\Profile\ProfileInterface;
 interface ClientInterface
 {
     /**
-     * Returns the server profile used by the client.
+     * Returns the command factory used by the client.
      *
-     * @return ProfileInterface
+     * @return FactoryInterface
      */
-    public function getProfile();
+    public function getCommandFactory();
 
     /**
      * Returns the client options specified upon initialization.

+ 2 - 2
src/Collection/Iterator/CursorBasedIterator.php

@@ -65,8 +65,8 @@ abstract class CursorBasedIterator implements \Iterator
      */
     protected function requiredCommand(ClientInterface $client, $commandID)
     {
-        if (!$client->getProfile()->supportsCommand($commandID)) {
-            throw new NotSupportedException("The current profile does not support '$commandID'.");
+        if (!$client->getCommandFactory()->supportsCommand($commandID)) {
+            throw new NotSupportedException("'$commandID' is not supported by the current command factory.");
         }
     }
 

+ 2 - 2
src/Collection/Iterator/ListKey.php

@@ -73,8 +73,8 @@ class ListKey implements \Iterator
      */
     protected function requiredCommand(ClientInterface $client, $commandID)
     {
-        if (!$client->getProfile()->supportsCommand($commandID)) {
-            throw new NotSupportedException("The current profile does not support '$commandID'.");
+        if (!$client->getCommandFactory()->supportsCommand($commandID)) {
+            throw new NotSupportedException("'$commandID' is not supported by the current command factory.");
         }
     }
 

+ 10 - 18
src/Profile/RedisProfile.php → src/Command/Factory.php

@@ -9,17 +9,20 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Profile;
+namespace Predis\Command;
 
 use Predis\ClientException;
 use Predis\Command\Processor\ProcessorInterface;
 
 /**
- * Base class implementing common functionalities for Redis server profiles.
+ * Base command factory.
+ *
+ * This class provides all of the common functionalities needed for the creation
+ * of new instances of Redis commands.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-abstract class RedisProfile implements ProfileInterface
+abstract class Factory implements FactoryInterface
 {
     private $commands;
     private $processor;
@@ -33,8 +36,8 @@ abstract class RedisProfile implements ProfileInterface
     }
 
     /**
-     * Returns a map of all the commands supported by the profile and their
-     * actual PHP classes.
+     * Returns all the commands supported by this factory mapped to their actual
+     * PHP classes.
      *
      * @return array
      */
@@ -63,8 +66,7 @@ abstract class RedisProfile implements ProfileInterface
     }
 
     /**
-     * Returns the fully-qualified name of a class representing the specified
-     * command ID registered in the current server profile.
+     * Returns the FQN of a class that represents the specified command ID.
      *
      * @param string $commandID Command ID.
      *
@@ -100,7 +102,7 @@ abstract class RedisProfile implements ProfileInterface
     }
 
     /**
-     * Defines a new command in the server profile.
+     * Defines a new command in the factory.
      *
      * @param string $commandID Command ID.
      * @param string $class     Fully-qualified name of a Predis\Command\CommandInterface.
@@ -133,14 +135,4 @@ abstract class RedisProfile implements ProfileInterface
     {
         return $this->processor;
     }
-
-    /**
-     * Returns the version of server profile as its string representation.
-     *
-     * @return string
-     */
-    public function __toString()
-    {
-        return $this->getVersion();
-    }
 }

+ 9 - 8
src/Profile/ProfileInterface.php → src/Command/FactoryInterface.php

@@ -9,28 +9,29 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Profile;
+namespace Predis\Command;
 
 use Predis\Command\CommandInterface;
 
 /**
- * A profile defines all the features and commands supported by certain versions
- * of Redis. Instances of Predis\Client should use a server profile matching the
- * version of Redis being used.
+ * Command factory interface.
+ *
+ * Each Redis command should have a class counterpart and commands factories are
+ * used to create new instances of these classes through the library.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-interface ProfileInterface
+interface FactoryInterface
 {
     /**
-     * Returns the profile version corresponding to the Redis version.
+     * Returns a string representing the current command factory.
      *
      * @return string
      */
     public function getVersion();
 
     /**
-     * Checks if the profile supports the specified command.
+     * Checks if the command factory supports the specified command.
      *
      * @param string $commandID Command ID.
      *
@@ -39,7 +40,7 @@ interface ProfileInterface
     public function supportsCommand($commandID);
 
     /**
-     * Checks if the profile supports the specified list of commands.
+     * Checks if the command factory supports the specified list of commands.
      *
      * @param array $commandIDs List of command IDs.
      *

+ 43 - 28
src/Command/Redis/ServerInfo.php

@@ -32,11 +32,52 @@ class ServerInfo extends Command
      * {@inheritdoc}
      */
     public function parseResponse($data)
+    {
+        if (empty($data) || !$lines = preg_split('/\r?\n/', $data)) {
+            return array();
+        }
+
+        if (strpos($lines[0], '#') === 0) {
+            return $this->parseNewResponseFormat($lines);
+        } else {
+            return $this->parseOldResponseFormat($lines);
+        }
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function parseNewResponseFormat($lines)
+    {
+        $info = array();
+        $current = null;
+
+        foreach ($lines as $row) {
+            if ($row === '') {
+                continue;
+            }
+
+            if (preg_match('/^# (\w+)$/', $row, $matches)) {
+                $info[$matches[1]] = array();
+                $current = &$info[$matches[1]];
+                continue;
+            }
+
+            list($k, $v) = $this->parseRow($row);
+            $current[$k] = $v;
+        }
+
+        return $info;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function parseOldResponseFormat($lines)
     {
         $info = array();
-        $infoLines = preg_split('/\r?\n/', $data);
 
-        foreach ($infoLines as $row) {
+        foreach ($lines as $row) {
             if (strpos($row, ':') === false) {
                 continue;
             }
@@ -84,30 +125,4 @@ class ServerInfo extends Command
 
         return $db;
     }
-
-    /**
-     * Parses the response and extracts the allocation statistics.
-     *
-     * @param string $str Response buffer.
-     *
-     * @return array
-     */
-    protected function parseAllocationStats($str)
-    {
-        $stats = array();
-
-        foreach (explode(',', $str) as $kv) {
-            @list($size, $objects, $extra) = explode('=', $kv);
-
-            // hack to prevent incorrect values when parsing the >=256 key
-            if (isset($extra)) {
-                $size = ">=$objects";
-                $objects = $extra;
-            }
-
-            $stats[$size] = $objects;
-        }
-
-        return $stats;
-    }
 }

+ 0 - 58
src/Command/Redis/ServerInfoV26x.php

@@ -1,58 +0,0 @@
-<?php
-
-/*
- * This file is part of the Predis package.
- *
- * (c) Daniele Alessandri <suppakilla@gmail.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Predis\Command\Redis;
-
-use Predis\Command\Command;
-
-/**
- * @link http://redis.io/commands/info
- *
- * @author Daniele Alessandri <suppakilla@gmail.com>
- */
-class ServerInfoV26x extends ServerInfo
-{
-    /**
-     * {@inheritdoc}
-     */
-    public function parseResponse($data)
-    {
-        if ($data === '') {
-            return array();
-        }
-
-        $info = array();
-
-        $current = null;
-        $infoLines = preg_split('/\r?\n/', $data);
-
-        if (isset($infoLines[0]) && $infoLines[0][0] !== '#') {
-            return parent::parseResponse($data);
-        }
-
-        foreach ($infoLines as $row) {
-            if ($row === '') {
-                continue;
-            }
-
-            if (preg_match('/^# (\w+)$/', $row, $matches)) {
-                $info[$matches[1]] = array();
-                $current = &$info[$matches[1]];
-                continue;
-            }
-
-            list($k, $v) = $this->parseRow($row);
-            $current[$k] = $v;
-        }
-
-        return $info;
-    }
-}

+ 4 - 4
src/Profile/RedisVersion320.php → src/Command/RedisFactory.php

@@ -9,14 +9,14 @@
  * file that was distributed with this source code.
  */
 
-namespace Predis\Profile;
+namespace Predis\Command;
 
 /**
- * Server profile for Redis 3.0.
+ * Command factory for the mainline Redis server.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class RedisVersion320 extends RedisProfile
+class RedisFactory extends Factory
 {
     /**
      * {@inheritdoc}
@@ -111,7 +111,7 @@ class RedisVersion320 extends RedisProfile
             'QUIT' => 'Predis\Command\Redis\ConnectionQuit',
 
             /* remote server control commands */
-            'INFO' => 'Predis\Command\Redis\ServerInfoV26x',
+            'INFO' => 'Predis\Command\Redis\ServerInfo',
             'SLAVEOF' => 'Predis\Command\Redis\ServerSlaveOf',
             'MONITOR' => 'Predis\Command\Redis\ServerMonitor',
             'DBSIZE' => 'Predis\Command\Redis\ServerDatabaseSize',

+ 14 - 19
src/Configuration/ProfileOption.php → src/Configuration/CommandsOption.php

@@ -11,33 +11,31 @@
 
 namespace Predis\Configuration;
 
-use Predis\Profile\Factory;
-use Predis\Profile\ProfileInterface;
-use Predis\Profile\RedisProfile;
+use Predis\Command\FactoryInterface;
+use Predis\Command\RedisFactory;
 
 /**
- * Configures the server profile to be used by the client to create command
- * instances depending on the specified version of the Redis server.
+ * Configures a connection factory to be used by the client.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class ProfileOption implements OptionInterface
+class CommandsOption implements OptionInterface
 {
     /**
-     * Sets the commands processors that need to be applied to the profile.
+     * Sets the commands processors to be used by the command factory.
      *
      * @param OptionsInterface $options Client options.
-     * @param ProfileInterface $profile Server profile.
+     * @param FactoryInterface $factory Command factory.
      */
-    protected function setProcessors(OptionsInterface $options, ProfileInterface $profile)
+    protected function setProcessors(OptionsInterface $options, FactoryInterface $factory)
     {
-        if (isset($options->prefix) && $profile instanceof RedisProfile) {
+        if (isset($options->prefix)) {
             // NOTE: directly using __get('prefix') is actually a workaround for
             // HHVM 2.3.0. It's correct and respects the options interface, it's
             // just ugly. We will remove this hack when HHVM will fix re-entrant
             // calls to __get() once and for all.
 
-            $profile->setProcessor($options->__get('prefix'));
+            $factory->setProcessor($options->__get('prefix'));
         }
     }
 
@@ -46,11 +44,8 @@ class ProfileOption implements OptionInterface
      */
     public function filter(OptionsInterface $options, $value)
     {
-        if (is_string($value)) {
-            $value = Factory::get($value);
-            $this->setProcessors($options, $value);
-        } elseif (!$value instanceof ProfileInterface) {
-            throw new \InvalidArgumentException('Invalid value for the profile option.');
+        if (!$value instanceof FactoryInterface) {
+            throw new \InvalidArgumentException('Invalid value for the commands option.');
         }
 
         return $value;
@@ -61,9 +56,9 @@ class ProfileOption implements OptionInterface
      */
     public function getDefault(OptionsInterface $options)
     {
-        $profile = Factory::getDefault();
-        $this->setProcessors($options, $profile);
+        $commands = new RedisFactory();
+        $this->setProcessors($options, $commands);
 
-        return $profile;
+        return $commands;
     }
 }

+ 1 - 1
src/Configuration/Options.php

@@ -47,7 +47,7 @@ class Options implements OptionsInterface
             'connections' => 'Predis\Configuration\ConnectionFactoryOption',
             'exceptions' => 'Predis\Configuration\ExceptionsOption',
             'prefix' => 'Predis\Configuration\PrefixOption',
-            'profile' => 'Predis\Configuration\ProfileOption',
+            'commands' => 'Predis\Configuration\CommandsOption',
             'replication' => 'Predis\Configuration\ReplicationOption',
         );
     }

+ 2 - 1
src/Configuration/OptionsInterface.php

@@ -19,8 +19,9 @@ namespace Predis\Configuration;
  * @property-read mixed connections Connection factory.
  * @property-read mixed exceptions  Toggles exceptions in client for -ERR responses.
  * @property-read mixed prefix      Key prefixing strategy using the given prefix.
- * @property-read mixed profile     Server profile.
+ * @property-read mixed commands    Command factory.
  * @property-read mixed replication Aggregate connection for replication.
+ * @property-read mixed parameters  Default connection parameters for aggregate connections.
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */

+ 2 - 2
src/Monitor/Consumer.php

@@ -62,8 +62,8 @@ class Consumer implements \Iterator
             );
         }
 
-        if ($client->getProfile()->supportsCommand('MONITOR') === false) {
-            throw new NotSupportedException("The current profile does not support 'MONITOR'.");
+        if ($client->getCommandFactory()->supportsCommand('MONITOR') === false) {
+            throw new NotSupportedException("'MONITOR' is not supported by the current command factory.");
         }
     }
 

+ 6 - 6
src/Pipeline/Atomic.php

@@ -31,9 +31,9 @@ class Atomic extends Pipeline
      */
     public function __construct(ClientInterface $client)
     {
-        if (!$client->getProfile()->supportsCommands(array('multi', 'exec', 'discard'))) {
+        if (!$client->getCommandFactory()->supportsCommands(array('multi', 'exec', 'discard'))) {
             throw new ClientException(
-                "The current profile does not support 'MULTI', 'EXEC' and 'DISCARD'."
+                "'MULTI', 'EXEC' and 'DISCARD' are not supported by the current command factory."
             );
         }
 
@@ -61,8 +61,8 @@ class Atomic extends Pipeline
      */
     protected function executePipeline(ConnectionInterface $connection, \SplQueue $commands)
     {
-        $profile = $this->getClient()->getProfile();
-        $connection->executeCommand($profile->createCommand('multi'));
+        $commandFactory = $this->getClient()->getCommandFactory();
+        $connection->executeCommand($commandFactory->createCommand('multi'));
 
         foreach ($commands as $command) {
             $connection->writeRequest($command);
@@ -72,12 +72,12 @@ class Atomic extends Pipeline
             $response = $connection->readResponse($command);
 
             if ($response instanceof ErrorResponseInterface) {
-                $connection->executeCommand($profile->createCommand('discard'));
+                $connection->executeCommand($commandFactory->createCommand('discard'));
                 throw new ServerException($response->getMessage());
             }
         }
 
-        $executed = $connection->executeCommand($profile->createCommand('exec'));
+        $executed = $connection->executeCommand($commandFactory->createCommand('exec'));
 
         if (!isset($executed)) {
             // TODO: should be throwing a more appropriate exception.

+ 0 - 101
src/Profile/Factory.php

@@ -1,101 +0,0 @@
-<?php
-
-/*
- * This file is part of the Predis package.
- *
- * (c) Daniele Alessandri <suppakilla@gmail.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Predis\Profile;
-
-use Predis\ClientException;
-
-/**
- * Factory class for creating profile instances from strings.
- *
- * @author Daniele Alessandri <suppakilla@gmail.com>
- */
-final class Factory
-{
-    private static $profiles = array(
-        '2.0' => 'Predis\Profile\RedisVersion200',
-        '2.2' => 'Predis\Profile\RedisVersion220',
-        '2.4' => 'Predis\Profile\RedisVersion240',
-        '2.6' => 'Predis\Profile\RedisVersion260',
-        '2.8' => 'Predis\Profile\RedisVersion280',
-        '3.0' => 'Predis\Profile\RedisVersion300',
-        '3.2' => 'Predis\Profile\RedisVersion320',
-        'dev' => 'Predis\Profile\RedisUnstable',
-        'default' => 'Predis\Profile\RedisVersion320',
-    );
-
-    /**
-     *
-     */
-    private function __construct()
-    {
-        // NOOP
-    }
-
-    /**
-     * Returns the default server profile.
-     *
-     * @return ProfileInterface
-     */
-    public static function getDefault()
-    {
-        return self::get('default');
-    }
-
-    /**
-     * Returns the development server profile.
-     *
-     * @return ProfileInterface
-     */
-    public static function getDevelopment()
-    {
-        return self::get('dev');
-    }
-
-    /**
-     * Registers a new server profile.
-     *
-     * @param string $alias Profile version or alias.
-     * @param string $class FQN of a class implementing Predis\Profile\ProfileInterface.
-     *
-     * @throws \InvalidArgumentException
-     */
-    public static function define($alias, $class)
-    {
-        $reflection = new \ReflectionClass($class);
-
-        if (!$reflection->isSubclassOf('Predis\Profile\ProfileInterface')) {
-            throw new \InvalidArgumentException("The class '$class' is not a valid profile class.");
-        }
-
-        self::$profiles[$alias] = $class;
-    }
-
-    /**
-     * Returns the specified server profile.
-     *
-     * @param string $version Profile version or alias.
-     *
-     * @throws ClientException
-     *
-     * @return ProfileInterface
-     */
-    public static function get($version)
-    {
-        if (!isset(self::$profiles[$version])) {
-            throw new ClientException("Unknown server profile: '$version'.");
-        }
-
-        $profile = self::$profiles[$version];
-
-        return new $profile();
-    }
-}

+ 0 - 38
src/Profile/RedisUnstable.php

@@ -1,38 +0,0 @@
-<?php
-
-/*
- * This file is part of the Predis package.
- *
- * (c) Daniele Alessandri <suppakilla@gmail.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Predis\Profile;
-
-/**
- * Server profile for the current unstable version of Redis.
- *
- * @author Daniele Alessandri <suppakilla@gmail.com>
- */
-class RedisUnstable extends RedisVersion320
-{
-    /**
-     * {@inheritdoc}
-     */
-    public function getVersion()
-    {
-        return '3.2';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getSupportedCommands()
-    {
-        return array_merge(parent::getSupportedCommands(), array(
-            // EMPTY
-        ));
-    }
-}

+ 0 - 173
src/Profile/RedisVersion200.php

@@ -1,173 +0,0 @@
-<?php
-
-/*
- * This file is part of the Predis package.
- *
- * (c) Daniele Alessandri <suppakilla@gmail.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Predis\Profile;
-
-/**
- * Server profile for Redis 2.0.
- *
- * @author Daniele Alessandri <suppakilla@gmail.com>
- */
-class RedisVersion200 extends RedisProfile
-{
-    /**
-     * {@inheritdoc}
-     */
-    public function getVersion()
-    {
-        return '2.0';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getSupportedCommands()
-    {
-        return array(
-            /* ---------------- Redis 1.2 ---------------- */
-
-            /* commands operating on the key space */
-            'EXISTS' => 'Predis\Command\Redis\KeyExists',
-            'DEL' => 'Predis\Command\Redis\KeyDelete',
-            'TYPE' => 'Predis\Command\Redis\KeyType',
-            'KEYS' => 'Predis\Command\Redis\KeyKeys',
-            'RANDOMKEY' => 'Predis\Command\Redis\KeyRandom',
-            'RENAME' => 'Predis\Command\Redis\KeyRename',
-            'RENAMENX' => 'Predis\Command\Redis\KeyRenamePreserve',
-            'EXPIRE' => 'Predis\Command\Redis\KeyExpire',
-            'EXPIREAT' => 'Predis\Command\Redis\KeyExpireAt',
-            'TTL' => 'Predis\Command\Redis\KeyTimeToLive',
-            'MOVE' => 'Predis\Command\Redis\KeyMove',
-            'SORT' => 'Predis\Command\Redis\KeySort',
-
-            /* commands operating on string values */
-            'SET' => 'Predis\Command\Redis\StringSet',
-            'SETNX' => 'Predis\Command\Redis\StringSetPreserve',
-            'MSET' => 'Predis\Command\Redis\StringSetMultiple',
-            'MSETNX' => 'Predis\Command\Redis\StringSetMultiplePreserve',
-            'GET' => 'Predis\Command\Redis\StringGet',
-            'MGET' => 'Predis\Command\Redis\StringGetMultiple',
-            'GETSET' => 'Predis\Command\Redis\StringGetSet',
-            'INCR' => 'Predis\Command\Redis\StringIncrement',
-            'INCRBY' => 'Predis\Command\Redis\StringIncrementBy',
-            'DECR' => 'Predis\Command\Redis\StringDecrement',
-            'DECRBY' => 'Predis\Command\Redis\StringDecrementBy',
-
-            /* commands operating on lists */
-            'RPUSH' => 'Predis\Command\Redis\ListPushTail',
-            'LPUSH' => 'Predis\Command\Redis\ListPushHead',
-            'LLEN' => 'Predis\Command\Redis\ListLength',
-            'LRANGE' => 'Predis\Command\Redis\ListRange',
-            'LTRIM' => 'Predis\Command\Redis\ListTrim',
-            'LINDEX' => 'Predis\Command\Redis\ListIndex',
-            'LSET' => 'Predis\Command\Redis\ListSet',
-            'LREM' => 'Predis\Command\Redis\ListRemove',
-            'LPOP' => 'Predis\Command\Redis\ListPopFirst',
-            'RPOP' => 'Predis\Command\Redis\ListPopLast',
-            'RPOPLPUSH' => 'Predis\Command\Redis\ListPopLastPushHead',
-
-            /* commands operating on sets */
-            'SADD' => 'Predis\Command\Redis\SetAdd',
-            'SREM' => 'Predis\Command\Redis\SetRemove',
-            'SPOP' => 'Predis\Command\Redis\SetPop',
-            'SMOVE' => 'Predis\Command\Redis\SetMove',
-            'SCARD' => 'Predis\Command\Redis\SetCardinality',
-            'SISMEMBER' => 'Predis\Command\Redis\SetIsMember',
-            'SINTER' => 'Predis\Command\Redis\SetIntersection',
-            'SINTERSTORE' => 'Predis\Command\Redis\SetIntersectionStore',
-            'SUNION' => 'Predis\Command\Redis\SetUnion',
-            'SUNIONSTORE' => 'Predis\Command\Redis\SetUnionStore',
-            'SDIFF' => 'Predis\Command\Redis\SetDifference',
-            'SDIFFSTORE' => 'Predis\Command\Redis\SetDifferenceStore',
-            'SMEMBERS' => 'Predis\Command\Redis\SetMembers',
-            'SRANDMEMBER' => 'Predis\Command\Redis\SetRandomMember',
-
-            /* commands operating on sorted sets */
-            'ZADD' => 'Predis\Command\Redis\ZSetAdd',
-            'ZINCRBY' => 'Predis\Command\Redis\ZSetIncrementBy',
-            'ZREM' => 'Predis\Command\Redis\ZSetRemove',
-            'ZRANGE' => 'Predis\Command\Redis\ZSetRange',
-            'ZREVRANGE' => 'Predis\Command\Redis\ZSetReverseRange',
-            'ZRANGEBYSCORE' => 'Predis\Command\Redis\ZSetRangeByScore',
-            'ZCARD' => 'Predis\Command\Redis\ZSetCardinality',
-            'ZSCORE' => 'Predis\Command\Redis\ZSetScore',
-            'ZREMRANGEBYSCORE' => 'Predis\Command\Redis\ZSetRemoveRangeByScore',
-
-            /* connection related commands */
-            'PING' => 'Predis\Command\Redis\ConnectionPing',
-            'AUTH' => 'Predis\Command\Redis\ConnectionAuth',
-            'SELECT' => 'Predis\Command\Redis\ConnectionSelect',
-            'ECHO' => 'Predis\Command\Redis\ConnectionEcho',
-            'QUIT' => 'Predis\Command\Redis\ConnectionQuit',
-
-            /* remote server control commands */
-            'INFO' => 'Predis\Command\Redis\ServerInfo',
-            'SLAVEOF' => 'Predis\Command\Redis\ServerSlaveOf',
-            'MONITOR' => 'Predis\Command\Redis\ServerMonitor',
-            'DBSIZE' => 'Predis\Command\Redis\ServerDatabaseSize',
-            'FLUSHDB' => 'Predis\Command\Redis\ServerFlushDatabase',
-            'FLUSHALL' => 'Predis\Command\Redis\ServerFlushAll',
-            'SAVE' => 'Predis\Command\Redis\ServerSave',
-            'BGSAVE' => 'Predis\Command\Redis\ServerBackgroundSave',
-            'LASTSAVE' => 'Predis\Command\Redis\ServerLastSave',
-            'SHUTDOWN' => 'Predis\Command\Redis\ServerShutdown',
-            'BGREWRITEAOF' => 'Predis\Command\Redis\ServerBackgroundRewriteAOF',
-
-            /* ---------------- Redis 2.0 ---------------- */
-
-            /* commands operating on string values */
-            'SETEX' => 'Predis\Command\Redis\StringSetExpire',
-            'APPEND' => 'Predis\Command\Redis\StringAppend',
-            'SUBSTR' => 'Predis\Command\Redis\StringSubstr',
-
-            /* commands operating on lists */
-            'BLPOP' => 'Predis\Command\Redis\ListPopFirstBlocking',
-            'BRPOP' => 'Predis\Command\Redis\ListPopLastBlocking',
-
-            /* commands operating on sorted sets */
-            'ZUNIONSTORE' => 'Predis\Command\Redis\ZSetUnionStore',
-            'ZINTERSTORE' => 'Predis\Command\Redis\ZSetIntersectionStore',
-            'ZCOUNT' => 'Predis\Command\Redis\ZSetCount',
-            'ZRANK' => 'Predis\Command\Redis\ZSetRank',
-            'ZREVRANK' => 'Predis\Command\Redis\ZSetReverseRank',
-            'ZREMRANGEBYRANK' => 'Predis\Command\Redis\ZSetRemoveRangeByRank',
-
-            /* commands operating on hashes */
-            'HSET' => 'Predis\Command\Redis\HashSet',
-            'HSETNX' => 'Predis\Command\Redis\HashSetPreserve',
-            'HMSET' => 'Predis\Command\Redis\HashSetMultiple',
-            'HINCRBY' => 'Predis\Command\Redis\HashIncrementBy',
-            'HGET' => 'Predis\Command\Redis\HashGet',
-            'HMGET' => 'Predis\Command\Redis\HashGetMultiple',
-            'HDEL' => 'Predis\Command\Redis\HashDelete',
-            'HEXISTS' => 'Predis\Command\Redis\HashExists',
-            'HLEN' => 'Predis\Command\Redis\HashLength',
-            'HKEYS' => 'Predis\Command\Redis\HashKeys',
-            'HVALS' => 'Predis\Command\Redis\HashValues',
-            'HGETALL' => 'Predis\Command\Redis\HashGetAll',
-
-            /* transactions */
-            'MULTI' => 'Predis\Command\Redis\TransactionMulti',
-            'EXEC' => 'Predis\Command\Redis\TransactionExec',
-            'DISCARD' => 'Predis\Command\Redis\TransactionDiscard',
-
-            /* publish - subscribe */
-            'SUBSCRIBE' => 'Predis\Command\Redis\PubSubSubscribe',
-            'UNSUBSCRIBE' => 'Predis\Command\Redis\PubSubUnsubscribe',
-            'PSUBSCRIBE' => 'Predis\Command\Redis\PubSubSubscribeByPattern',
-            'PUNSUBSCRIBE' => 'Predis\Command\Redis\PubSubUnsubscribeByPattern',
-            'PUBLISH' => 'Predis\Command\Redis\PubSubPublish',
-
-            /* remote server control commands */
-            'CONFIG' => 'Predis\Command\Redis\ServerConfig',
-        );
-    }
-}

+ 0 - 202
src/Profile/RedisVersion220.php

@@ -1,202 +0,0 @@
-<?php
-
-/*
- * This file is part of the Predis package.
- *
- * (c) Daniele Alessandri <suppakilla@gmail.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Predis\Profile;
-
-/**
- * Server profile for Redis 2.2.
- *
- * @author Daniele Alessandri <suppakilla@gmail.com>
- */
-class RedisVersion220 extends RedisProfile
-{
-    /**
-     * {@inheritdoc}
-     */
-    public function getVersion()
-    {
-        return '2.2';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getSupportedCommands()
-    {
-        return array(
-            /* ---------------- Redis 1.2 ---------------- */
-
-            /* commands operating on the key space */
-            'EXISTS' => 'Predis\Command\Redis\KeyExists',
-            'DEL' => 'Predis\Command\Redis\KeyDelete',
-            'TYPE' => 'Predis\Command\Redis\KeyType',
-            'KEYS' => 'Predis\Command\Redis\KeyKeys',
-            'RANDOMKEY' => 'Predis\Command\Redis\KeyRandom',
-            'RENAME' => 'Predis\Command\Redis\KeyRename',
-            'RENAMENX' => 'Predis\Command\Redis\KeyRenamePreserve',
-            'EXPIRE' => 'Predis\Command\Redis\KeyExpire',
-            'EXPIREAT' => 'Predis\Command\Redis\KeyExpireAt',
-            'TTL' => 'Predis\Command\Redis\KeyTimeToLive',
-            'MOVE' => 'Predis\Command\Redis\KeyMove',
-            'SORT' => 'Predis\Command\Redis\KeySort',
-
-            /* commands operating on string values */
-            'SET' => 'Predis\Command\Redis\StringSet',
-            'SETNX' => 'Predis\Command\Redis\StringSetPreserve',
-            'MSET' => 'Predis\Command\Redis\StringSetMultiple',
-            'MSETNX' => 'Predis\Command\Redis\StringSetMultiplePreserve',
-            'GET' => 'Predis\Command\Redis\StringGet',
-            'MGET' => 'Predis\Command\Redis\StringGetMultiple',
-            'GETSET' => 'Predis\Command\Redis\StringGetSet',
-            'INCR' => 'Predis\Command\Redis\StringIncrement',
-            'INCRBY' => 'Predis\Command\Redis\StringIncrementBy',
-            'DECR' => 'Predis\Command\Redis\StringDecrement',
-            'DECRBY' => 'Predis\Command\Redis\StringDecrementBy',
-
-            /* commands operating on lists */
-            'RPUSH' => 'Predis\Command\Redis\ListPushTail',
-            'LPUSH' => 'Predis\Command\Redis\ListPushHead',
-            'LLEN' => 'Predis\Command\Redis\ListLength',
-            'LRANGE' => 'Predis\Command\Redis\ListRange',
-            'LTRIM' => 'Predis\Command\Redis\ListTrim',
-            'LINDEX' => 'Predis\Command\Redis\ListIndex',
-            'LSET' => 'Predis\Command\Redis\ListSet',
-            'LREM' => 'Predis\Command\Redis\ListRemove',
-            'LPOP' => 'Predis\Command\Redis\ListPopFirst',
-            'RPOP' => 'Predis\Command\Redis\ListPopLast',
-            'RPOPLPUSH' => 'Predis\Command\Redis\ListPopLastPushHead',
-
-            /* commands operating on sets */
-            'SADD' => 'Predis\Command\Redis\SetAdd',
-            'SREM' => 'Predis\Command\Redis\SetRemove',
-            'SPOP' => 'Predis\Command\Redis\SetPop',
-            'SMOVE' => 'Predis\Command\Redis\SetMove',
-            'SCARD' => 'Predis\Command\Redis\SetCardinality',
-            'SISMEMBER' => 'Predis\Command\Redis\SetIsMember',
-            'SINTER' => 'Predis\Command\Redis\SetIntersection',
-            'SINTERSTORE' => 'Predis\Command\Redis\SetIntersectionStore',
-            'SUNION' => 'Predis\Command\Redis\SetUnion',
-            'SUNIONSTORE' => 'Predis\Command\Redis\SetUnionStore',
-            'SDIFF' => 'Predis\Command\Redis\SetDifference',
-            'SDIFFSTORE' => 'Predis\Command\Redis\SetDifferenceStore',
-            'SMEMBERS' => 'Predis\Command\Redis\SetMembers',
-            'SRANDMEMBER' => 'Predis\Command\Redis\SetRandomMember',
-
-            /* commands operating on sorted sets */
-            'ZADD' => 'Predis\Command\Redis\ZSetAdd',
-            'ZINCRBY' => 'Predis\Command\Redis\ZSetIncrementBy',
-            'ZREM' => 'Predis\Command\Redis\ZSetRemove',
-            'ZRANGE' => 'Predis\Command\Redis\ZSetRange',
-            'ZREVRANGE' => 'Predis\Command\Redis\ZSetReverseRange',
-            'ZRANGEBYSCORE' => 'Predis\Command\Redis\ZSetRangeByScore',
-            'ZCARD' => 'Predis\Command\Redis\ZSetCardinality',
-            'ZSCORE' => 'Predis\Command\Redis\ZSetScore',
-            'ZREMRANGEBYSCORE' => 'Predis\Command\Redis\ZSetRemoveRangeByScore',
-
-            /* connection related commands */
-            'PING' => 'Predis\Command\Redis\ConnectionPing',
-            'AUTH' => 'Predis\Command\Redis\ConnectionAuth',
-            'SELECT' => 'Predis\Command\Redis\ConnectionSelect',
-            'ECHO' => 'Predis\Command\Redis\ConnectionEcho',
-            'QUIT' => 'Predis\Command\Redis\ConnectionQuit',
-
-            /* remote server control commands */
-            'INFO' => 'Predis\Command\Redis\ServerInfo',
-            'SLAVEOF' => 'Predis\Command\Redis\ServerSlaveOf',
-            'MONITOR' => 'Predis\Command\Redis\ServerMonitor',
-            'DBSIZE' => 'Predis\Command\Redis\ServerDatabaseSize',
-            'FLUSHDB' => 'Predis\Command\Redis\ServerFlushDatabase',
-            'FLUSHALL' => 'Predis\Command\Redis\ServerFlushAll',
-            'SAVE' => 'Predis\Command\Redis\ServerSave',
-            'BGSAVE' => 'Predis\Command\Redis\ServerBackgroundSave',
-            'LASTSAVE' => 'Predis\Command\Redis\ServerLastSave',
-            'SHUTDOWN' => 'Predis\Command\Redis\ServerShutdown',
-            'BGREWRITEAOF' => 'Predis\Command\Redis\ServerBackgroundRewriteAOF',
-
-            /* ---------------- Redis 2.0 ---------------- */
-
-            /* commands operating on string values */
-            'SETEX' => 'Predis\Command\Redis\StringSetExpire',
-            'APPEND' => 'Predis\Command\Redis\StringAppend',
-            'SUBSTR' => 'Predis\Command\Redis\StringSubstr',
-
-            /* commands operating on lists */
-            'BLPOP' => 'Predis\Command\Redis\ListPopFirstBlocking',
-            'BRPOP' => 'Predis\Command\Redis\ListPopLastBlocking',
-
-            /* commands operating on sorted sets */
-            'ZUNIONSTORE' => 'Predis\Command\Redis\ZSetUnionStore',
-            'ZINTERSTORE' => 'Predis\Command\Redis\ZSetIntersectionStore',
-            'ZCOUNT' => 'Predis\Command\Redis\ZSetCount',
-            'ZRANK' => 'Predis\Command\Redis\ZSetRank',
-            'ZREVRANK' => 'Predis\Command\Redis\ZSetReverseRank',
-            'ZREMRANGEBYRANK' => 'Predis\Command\Redis\ZSetRemoveRangeByRank',
-
-            /* commands operating on hashes */
-            'HSET' => 'Predis\Command\Redis\HashSet',
-            'HSETNX' => 'Predis\Command\Redis\HashSetPreserve',
-            'HMSET' => 'Predis\Command\Redis\HashSetMultiple',
-            'HINCRBY' => 'Predis\Command\Redis\HashIncrementBy',
-            'HGET' => 'Predis\Command\Redis\HashGet',
-            'HMGET' => 'Predis\Command\Redis\HashGetMultiple',
-            'HDEL' => 'Predis\Command\Redis\HashDelete',
-            'HEXISTS' => 'Predis\Command\Redis\HashExists',
-            'HLEN' => 'Predis\Command\Redis\HashLength',
-            'HKEYS' => 'Predis\Command\Redis\HashKeys',
-            'HVALS' => 'Predis\Command\Redis\HashValues',
-            'HGETALL' => 'Predis\Command\Redis\HashGetAll',
-
-            /* transactions */
-            'MULTI' => 'Predis\Command\Redis\TransactionMulti',
-            'EXEC' => 'Predis\Command\Redis\TransactionExec',
-            'DISCARD' => 'Predis\Command\Redis\TransactionDiscard',
-
-            /* publish - subscribe */
-            'SUBSCRIBE' => 'Predis\Command\Redis\PubSubSubscribe',
-            'UNSUBSCRIBE' => 'Predis\Command\Redis\PubSubUnsubscribe',
-            'PSUBSCRIBE' => 'Predis\Command\Redis\PubSubSubscribeByPattern',
-            'PUNSUBSCRIBE' => 'Predis\Command\Redis\PubSubUnsubscribeByPattern',
-            'PUBLISH' => 'Predis\Command\Redis\PubSubPublish',
-
-            /* remote server control commands */
-            'CONFIG' => 'Predis\Command\Redis\ServerConfig',
-
-            /* ---------------- Redis 2.2 ---------------- */
-
-            /* commands operating on the key space */
-            'PERSIST' => 'Predis\Command\Redis\KeyPersist',
-
-            /* commands operating on string values */
-            'STRLEN' => 'Predis\Command\Redis\StringStrlen',
-            'SETRANGE' => 'Predis\Command\Redis\StringSetRange',
-            'GETRANGE' => 'Predis\Command\Redis\StringGetRange',
-            'SETBIT' => 'Predis\Command\Redis\StringSetBit',
-            'GETBIT' => 'Predis\Command\Redis\StringGetBit',
-
-            /* commands operating on lists */
-            'RPUSHX' => 'Predis\Command\Redis\ListPushTailX',
-            'LPUSHX' => 'Predis\Command\Redis\ListPushHeadX',
-            'LINSERT' => 'Predis\Command\Redis\ListInsert',
-            'BRPOPLPUSH' => 'Predis\Command\Redis\ListPopLastPushHeadBlocking',
-
-            /* commands operating on sorted sets */
-            'ZREVRANGEBYSCORE' => 'Predis\Command\Redis\ZSetReverseRangeByScore',
-
-            /* transactions */
-            'WATCH' => 'Predis\Command\Redis\TransactionWatch',
-            'UNWATCH' => 'Predis\Command\Redis\TransactionUnwatch',
-
-            /* remote server control commands */
-            'OBJECT' => 'Predis\Command\Redis\ServerObject',
-            'SLOWLOG' => 'Predis\Command\Redis\ServerSlowlog',
-        );
-    }
-}

+ 0 - 207
src/Profile/RedisVersion240.php

@@ -1,207 +0,0 @@
-<?php
-
-/*
- * This file is part of the Predis package.
- *
- * (c) Daniele Alessandri <suppakilla@gmail.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Predis\Profile;
-
-/**
- * Server profile for Redis 2.4.
- *
- * @author Daniele Alessandri <suppakilla@gmail.com>
- */
-class RedisVersion240 extends RedisProfile
-{
-    /**
-     * {@inheritdoc}
-     */
-    public function getVersion()
-    {
-        return '2.4';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getSupportedCommands()
-    {
-        return array(
-            /* ---------------- Redis 1.2 ---------------- */
-
-            /* commands operating on the key space */
-            'EXISTS' => 'Predis\Command\Redis\KeyExists',
-            'DEL' => 'Predis\Command\Redis\KeyDelete',
-            'TYPE' => 'Predis\Command\Redis\KeyType',
-            'KEYS' => 'Predis\Command\Redis\KeyKeys',
-            'RANDOMKEY' => 'Predis\Command\Redis\KeyRandom',
-            'RENAME' => 'Predis\Command\Redis\KeyRename',
-            'RENAMENX' => 'Predis\Command\Redis\KeyRenamePreserve',
-            'EXPIRE' => 'Predis\Command\Redis\KeyExpire',
-            'EXPIREAT' => 'Predis\Command\Redis\KeyExpireAt',
-            'TTL' => 'Predis\Command\Redis\KeyTimeToLive',
-            'MOVE' => 'Predis\Command\Redis\KeyMove',
-            'SORT' => 'Predis\Command\Redis\KeySort',
-
-            /* commands operating on string values */
-            'SET' => 'Predis\Command\Redis\StringSet',
-            'SETNX' => 'Predis\Command\Redis\StringSetPreserve',
-            'MSET' => 'Predis\Command\Redis\StringSetMultiple',
-            'MSETNX' => 'Predis\Command\Redis\StringSetMultiplePreserve',
-            'GET' => 'Predis\Command\Redis\StringGet',
-            'MGET' => 'Predis\Command\Redis\StringGetMultiple',
-            'GETSET' => 'Predis\Command\Redis\StringGetSet',
-            'INCR' => 'Predis\Command\Redis\StringIncrement',
-            'INCRBY' => 'Predis\Command\Redis\StringIncrementBy',
-            'DECR' => 'Predis\Command\Redis\StringDecrement',
-            'DECRBY' => 'Predis\Command\Redis\StringDecrementBy',
-
-            /* commands operating on lists */
-            'RPUSH' => 'Predis\Command\Redis\ListPushTail',
-            'LPUSH' => 'Predis\Command\Redis\ListPushHead',
-            'LLEN' => 'Predis\Command\Redis\ListLength',
-            'LRANGE' => 'Predis\Command\Redis\ListRange',
-            'LTRIM' => 'Predis\Command\Redis\ListTrim',
-            'LINDEX' => 'Predis\Command\Redis\ListIndex',
-            'LSET' => 'Predis\Command\Redis\ListSet',
-            'LREM' => 'Predis\Command\Redis\ListRemove',
-            'LPOP' => 'Predis\Command\Redis\ListPopFirst',
-            'RPOP' => 'Predis\Command\Redis\ListPopLast',
-            'RPOPLPUSH' => 'Predis\Command\Redis\ListPopLastPushHead',
-
-            /* commands operating on sets */
-            'SADD' => 'Predis\Command\Redis\SetAdd',
-            'SREM' => 'Predis\Command\Redis\SetRemove',
-            'SPOP' => 'Predis\Command\Redis\SetPop',
-            'SMOVE' => 'Predis\Command\Redis\SetMove',
-            'SCARD' => 'Predis\Command\Redis\SetCardinality',
-            'SISMEMBER' => 'Predis\Command\Redis\SetIsMember',
-            'SINTER' => 'Predis\Command\Redis\SetIntersection',
-            'SINTERSTORE' => 'Predis\Command\Redis\SetIntersectionStore',
-            'SUNION' => 'Predis\Command\Redis\SetUnion',
-            'SUNIONSTORE' => 'Predis\Command\Redis\SetUnionStore',
-            'SDIFF' => 'Predis\Command\Redis\SetDifference',
-            'SDIFFSTORE' => 'Predis\Command\Redis\SetDifferenceStore',
-            'SMEMBERS' => 'Predis\Command\Redis\SetMembers',
-            'SRANDMEMBER' => 'Predis\Command\Redis\SetRandomMember',
-
-            /* commands operating on sorted sets */
-            'ZADD' => 'Predis\Command\Redis\ZSetAdd',
-            'ZINCRBY' => 'Predis\Command\Redis\ZSetIncrementBy',
-            'ZREM' => 'Predis\Command\Redis\ZSetRemove',
-            'ZRANGE' => 'Predis\Command\Redis\ZSetRange',
-            'ZREVRANGE' => 'Predis\Command\Redis\ZSetReverseRange',
-            'ZRANGEBYSCORE' => 'Predis\Command\Redis\ZSetRangeByScore',
-            'ZCARD' => 'Predis\Command\Redis\ZSetCardinality',
-            'ZSCORE' => 'Predis\Command\Redis\ZSetScore',
-            'ZREMRANGEBYSCORE' => 'Predis\Command\Redis\ZSetRemoveRangeByScore',
-
-            /* connection related commands */
-            'PING' => 'Predis\Command\Redis\ConnectionPing',
-            'AUTH' => 'Predis\Command\Redis\ConnectionAuth',
-            'SELECT' => 'Predis\Command\Redis\ConnectionSelect',
-            'ECHO' => 'Predis\Command\Redis\ConnectionEcho',
-            'QUIT' => 'Predis\Command\Redis\ConnectionQuit',
-
-            /* remote server control commands */
-            'INFO' => 'Predis\Command\Redis\ServerInfo',
-            'SLAVEOF' => 'Predis\Command\Redis\ServerSlaveOf',
-            'MONITOR' => 'Predis\Command\Redis\ServerMonitor',
-            'DBSIZE' => 'Predis\Command\Redis\ServerDatabaseSize',
-            'FLUSHDB' => 'Predis\Command\Redis\ServerFlushDatabase',
-            'FLUSHALL' => 'Predis\Command\Redis\ServerFlushAll',
-            'SAVE' => 'Predis\Command\Redis\ServerSave',
-            'BGSAVE' => 'Predis\Command\Redis\ServerBackgroundSave',
-            'LASTSAVE' => 'Predis\Command\Redis\ServerLastSave',
-            'SHUTDOWN' => 'Predis\Command\Redis\ServerShutdown',
-            'BGREWRITEAOF' => 'Predis\Command\Redis\ServerBackgroundRewriteAOF',
-
-            /* ---------------- Redis 2.0 ---------------- */
-
-            /* commands operating on string values */
-            'SETEX' => 'Predis\Command\Redis\StringSetExpire',
-            'APPEND' => 'Predis\Command\Redis\StringAppend',
-            'SUBSTR' => 'Predis\Command\Redis\StringSubstr',
-
-            /* commands operating on lists */
-            'BLPOP' => 'Predis\Command\Redis\ListPopFirstBlocking',
-            'BRPOP' => 'Predis\Command\Redis\ListPopLastBlocking',
-
-            /* commands operating on sorted sets */
-            'ZUNIONSTORE' => 'Predis\Command\Redis\ZSetUnionStore',
-            'ZINTERSTORE' => 'Predis\Command\Redis\ZSetIntersectionStore',
-            'ZCOUNT' => 'Predis\Command\Redis\ZSetCount',
-            'ZRANK' => 'Predis\Command\Redis\ZSetRank',
-            'ZREVRANK' => 'Predis\Command\Redis\ZSetReverseRank',
-            'ZREMRANGEBYRANK' => 'Predis\Command\Redis\ZSetRemoveRangeByRank',
-
-            /* commands operating on hashes */
-            'HSET' => 'Predis\Command\Redis\HashSet',
-            'HSETNX' => 'Predis\Command\Redis\HashSetPreserve',
-            'HMSET' => 'Predis\Command\Redis\HashSetMultiple',
-            'HINCRBY' => 'Predis\Command\Redis\HashIncrementBy',
-            'HGET' => 'Predis\Command\Redis\HashGet',
-            'HMGET' => 'Predis\Command\Redis\HashGetMultiple',
-            'HDEL' => 'Predis\Command\Redis\HashDelete',
-            'HEXISTS' => 'Predis\Command\Redis\HashExists',
-            'HLEN' => 'Predis\Command\Redis\HashLength',
-            'HKEYS' => 'Predis\Command\Redis\HashKeys',
-            'HVALS' => 'Predis\Command\Redis\HashValues',
-            'HGETALL' => 'Predis\Command\Redis\HashGetAll',
-
-            /* transactions */
-            'MULTI' => 'Predis\Command\Redis\TransactionMulti',
-            'EXEC' => 'Predis\Command\Redis\TransactionExec',
-            'DISCARD' => 'Predis\Command\Redis\TransactionDiscard',
-
-            /* publish - subscribe */
-            'SUBSCRIBE' => 'Predis\Command\Redis\PubSubSubscribe',
-            'UNSUBSCRIBE' => 'Predis\Command\Redis\PubSubUnsubscribe',
-            'PSUBSCRIBE' => 'Predis\Command\Redis\PubSubSubscribeByPattern',
-            'PUNSUBSCRIBE' => 'Predis\Command\Redis\PubSubUnsubscribeByPattern',
-            'PUBLISH' => 'Predis\Command\Redis\PubSubPublish',
-
-            /* remote server control commands */
-            'CONFIG' => 'Predis\Command\Redis\ServerConfig',
-
-            /* ---------------- Redis 2.2 ---------------- */
-
-            /* commands operating on the key space */
-            'PERSIST' => 'Predis\Command\Redis\KeyPersist',
-
-            /* commands operating on string values */
-            'STRLEN' => 'Predis\Command\Redis\StringStrlen',
-            'SETRANGE' => 'Predis\Command\Redis\StringSetRange',
-            'GETRANGE' => 'Predis\Command\Redis\StringGetRange',
-            'SETBIT' => 'Predis\Command\Redis\StringSetBit',
-            'GETBIT' => 'Predis\Command\Redis\StringGetBit',
-
-            /* commands operating on lists */
-            'RPUSHX' => 'Predis\Command\Redis\ListPushTailX',
-            'LPUSHX' => 'Predis\Command\Redis\ListPushHeadX',
-            'LINSERT' => 'Predis\Command\Redis\ListInsert',
-            'BRPOPLPUSH' => 'Predis\Command\Redis\ListPopLastPushHeadBlocking',
-
-            /* commands operating on sorted sets */
-            'ZREVRANGEBYSCORE' => 'Predis\Command\Redis\ZSetReverseRangeByScore',
-
-            /* transactions */
-            'WATCH' => 'Predis\Command\Redis\TransactionWatch',
-            'UNWATCH' => 'Predis\Command\Redis\TransactionUnwatch',
-
-            /* remote server control commands */
-            'OBJECT' => 'Predis\Command\Redis\ServerObject',
-            'SLOWLOG' => 'Predis\Command\Redis\ServerSlowlog',
-
-            /* ---------------- Redis 2.4 ---------------- */
-
-            /* remote server control commands */
-            'CLIENT' => 'Predis\Command\Redis\ServerClient',
-        );
-    }
-}

+ 0 - 235
src/Profile/RedisVersion260.php

@@ -1,235 +0,0 @@
-<?php
-
-/*
- * This file is part of the Predis package.
- *
- * (c) Daniele Alessandri <suppakilla@gmail.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Predis\Profile;
-
-/**
- * Server profile for Redis 2.6.
- *
- * @author Daniele Alessandri <suppakilla@gmail.com>
- */
-class RedisVersion260 extends RedisProfile
-{
-    /**
-     * {@inheritdoc}
-     */
-    public function getVersion()
-    {
-        return '2.6';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getSupportedCommands()
-    {
-        return array(
-            /* ---------------- Redis 1.2 ---------------- */
-
-            /* commands operating on the key space */
-            'EXISTS' => 'Predis\Command\Redis\KeyExists',
-            'DEL' => 'Predis\Command\Redis\KeyDelete',
-            'TYPE' => 'Predis\Command\Redis\KeyType',
-            'KEYS' => 'Predis\Command\Redis\KeyKeys',
-            'RANDOMKEY' => 'Predis\Command\Redis\KeyRandom',
-            'RENAME' => 'Predis\Command\Redis\KeyRename',
-            'RENAMENX' => 'Predis\Command\Redis\KeyRenamePreserve',
-            'EXPIRE' => 'Predis\Command\Redis\KeyExpire',
-            'EXPIREAT' => 'Predis\Command\Redis\KeyExpireAt',
-            'TTL' => 'Predis\Command\Redis\KeyTimeToLive',
-            'MOVE' => 'Predis\Command\Redis\KeyMove',
-            'SORT' => 'Predis\Command\Redis\KeySort',
-            'DUMP' => 'Predis\Command\Redis\KeyDump',
-            'RESTORE' => 'Predis\Command\Redis\KeyRestore',
-
-            /* commands operating on string values */
-            'SET' => 'Predis\Command\Redis\StringSet',
-            'SETNX' => 'Predis\Command\Redis\StringSetPreserve',
-            'MSET' => 'Predis\Command\Redis\StringSetMultiple',
-            'MSETNX' => 'Predis\Command\Redis\StringSetMultiplePreserve',
-            'GET' => 'Predis\Command\Redis\StringGet',
-            'MGET' => 'Predis\Command\Redis\StringGetMultiple',
-            'GETSET' => 'Predis\Command\Redis\StringGetSet',
-            'INCR' => 'Predis\Command\Redis\StringIncrement',
-            'INCRBY' => 'Predis\Command\Redis\StringIncrementBy',
-            'DECR' => 'Predis\Command\Redis\StringDecrement',
-            'DECRBY' => 'Predis\Command\Redis\StringDecrementBy',
-
-            /* commands operating on lists */
-            'RPUSH' => 'Predis\Command\Redis\ListPushTail',
-            'LPUSH' => 'Predis\Command\Redis\ListPushHead',
-            'LLEN' => 'Predis\Command\Redis\ListLength',
-            'LRANGE' => 'Predis\Command\Redis\ListRange',
-            'LTRIM' => 'Predis\Command\Redis\ListTrim',
-            'LINDEX' => 'Predis\Command\Redis\ListIndex',
-            'LSET' => 'Predis\Command\Redis\ListSet',
-            'LREM' => 'Predis\Command\Redis\ListRemove',
-            'LPOP' => 'Predis\Command\Redis\ListPopFirst',
-            'RPOP' => 'Predis\Command\Redis\ListPopLast',
-            'RPOPLPUSH' => 'Predis\Command\Redis\ListPopLastPushHead',
-
-            /* commands operating on sets */
-            'SADD' => 'Predis\Command\Redis\SetAdd',
-            'SREM' => 'Predis\Command\Redis\SetRemove',
-            'SPOP' => 'Predis\Command\Redis\SetPop',
-            'SMOVE' => 'Predis\Command\Redis\SetMove',
-            'SCARD' => 'Predis\Command\Redis\SetCardinality',
-            'SISMEMBER' => 'Predis\Command\Redis\SetIsMember',
-            'SINTER' => 'Predis\Command\Redis\SetIntersection',
-            'SINTERSTORE' => 'Predis\Command\Redis\SetIntersectionStore',
-            'SUNION' => 'Predis\Command\Redis\SetUnion',
-            'SUNIONSTORE' => 'Predis\Command\Redis\SetUnionStore',
-            'SDIFF' => 'Predis\Command\Redis\SetDifference',
-            'SDIFFSTORE' => 'Predis\Command\Redis\SetDifferenceStore',
-            'SMEMBERS' => 'Predis\Command\Redis\SetMembers',
-            'SRANDMEMBER' => 'Predis\Command\Redis\SetRandomMember',
-
-            /* commands operating on sorted sets */
-            'ZADD' => 'Predis\Command\Redis\ZSetAdd',
-            'ZINCRBY' => 'Predis\Command\Redis\ZSetIncrementBy',
-            'ZREM' => 'Predis\Command\Redis\ZSetRemove',
-            'ZRANGE' => 'Predis\Command\Redis\ZSetRange',
-            'ZREVRANGE' => 'Predis\Command\Redis\ZSetReverseRange',
-            'ZRANGEBYSCORE' => 'Predis\Command\Redis\ZSetRangeByScore',
-            'ZCARD' => 'Predis\Command\Redis\ZSetCardinality',
-            'ZSCORE' => 'Predis\Command\Redis\ZSetScore',
-            'ZREMRANGEBYSCORE' => 'Predis\Command\Redis\ZSetRemoveRangeByScore',
-
-            /* connection related commands */
-            'PING' => 'Predis\Command\Redis\ConnectionPing',
-            'AUTH' => 'Predis\Command\Redis\ConnectionAuth',
-            'SELECT' => 'Predis\Command\Redis\ConnectionSelect',
-            'ECHO' => 'Predis\Command\Redis\ConnectionEcho',
-            'QUIT' => 'Predis\Command\Redis\ConnectionQuit',
-
-            /* remote server control commands */
-            'INFO' => 'Predis\Command\Redis\ServerInfoV26x',
-            'SLAVEOF' => 'Predis\Command\Redis\ServerSlaveOf',
-            'MONITOR' => 'Predis\Command\Redis\ServerMonitor',
-            'DBSIZE' => 'Predis\Command\Redis\ServerDatabaseSize',
-            'FLUSHDB' => 'Predis\Command\Redis\ServerFlushDatabase',
-            'FLUSHALL' => 'Predis\Command\Redis\ServerFlushAll',
-            'SAVE' => 'Predis\Command\Redis\ServerSave',
-            'BGSAVE' => 'Predis\Command\Redis\ServerBackgroundSave',
-            'LASTSAVE' => 'Predis\Command\Redis\ServerLastSave',
-            'SHUTDOWN' => 'Predis\Command\Redis\ServerShutdown',
-            'BGREWRITEAOF' => 'Predis\Command\Redis\ServerBackgroundRewriteAOF',
-
-            /* ---------------- Redis 2.0 ---------------- */
-
-            /* commands operating on string values */
-            'SETEX' => 'Predis\Command\Redis\StringSetExpire',
-            'APPEND' => 'Predis\Command\Redis\StringAppend',
-            'SUBSTR' => 'Predis\Command\Redis\StringSubstr',
-
-            /* commands operating on lists */
-            'BLPOP' => 'Predis\Command\Redis\ListPopFirstBlocking',
-            'BRPOP' => 'Predis\Command\Redis\ListPopLastBlocking',
-
-            /* commands operating on sorted sets */
-            'ZUNIONSTORE' => 'Predis\Command\Redis\ZSetUnionStore',
-            'ZINTERSTORE' => 'Predis\Command\Redis\ZSetIntersectionStore',
-            'ZCOUNT' => 'Predis\Command\Redis\ZSetCount',
-            'ZRANK' => 'Predis\Command\Redis\ZSetRank',
-            'ZREVRANK' => 'Predis\Command\Redis\ZSetReverseRank',
-            'ZREMRANGEBYRANK' => 'Predis\Command\Redis\ZSetRemoveRangeByRank',
-
-            /* commands operating on hashes */
-            'HSET' => 'Predis\Command\Redis\HashSet',
-            'HSETNX' => 'Predis\Command\Redis\HashSetPreserve',
-            'HMSET' => 'Predis\Command\Redis\HashSetMultiple',
-            'HINCRBY' => 'Predis\Command\Redis\HashIncrementBy',
-            'HGET' => 'Predis\Command\Redis\HashGet',
-            'HMGET' => 'Predis\Command\Redis\HashGetMultiple',
-            'HDEL' => 'Predis\Command\Redis\HashDelete',
-            'HEXISTS' => 'Predis\Command\Redis\HashExists',
-            'HLEN' => 'Predis\Command\Redis\HashLength',
-            'HKEYS' => 'Predis\Command\Redis\HashKeys',
-            'HVALS' => 'Predis\Command\Redis\HashValues',
-            'HGETALL' => 'Predis\Command\Redis\HashGetAll',
-
-            /* transactions */
-            'MULTI' => 'Predis\Command\Redis\TransactionMulti',
-            'EXEC' => 'Predis\Command\Redis\TransactionExec',
-            'DISCARD' => 'Predis\Command\Redis\TransactionDiscard',
-
-            /* publish - subscribe */
-            'SUBSCRIBE' => 'Predis\Command\Redis\PubSubSubscribe',
-            'UNSUBSCRIBE' => 'Predis\Command\Redis\PubSubUnsubscribe',
-            'PSUBSCRIBE' => 'Predis\Command\Redis\PubSubSubscribeByPattern',
-            'PUNSUBSCRIBE' => 'Predis\Command\Redis\PubSubUnsubscribeByPattern',
-            'PUBLISH' => 'Predis\Command\Redis\PubSubPublish',
-
-            /* remote server control commands */
-            'CONFIG' => 'Predis\Command\Redis\ServerConfig',
-
-            /* ---------------- Redis 2.2 ---------------- */
-
-            /* commands operating on the key space */
-            'PERSIST' => 'Predis\Command\Redis\KeyPersist',
-
-            /* commands operating on string values */
-            'STRLEN' => 'Predis\Command\Redis\StringStrlen',
-            'SETRANGE' => 'Predis\Command\Redis\StringSetRange',
-            'GETRANGE' => 'Predis\Command\Redis\StringGetRange',
-            'SETBIT' => 'Predis\Command\Redis\StringSetBit',
-            'GETBIT' => 'Predis\Command\Redis\StringGetBit',
-
-            /* commands operating on lists */
-            'RPUSHX' => 'Predis\Command\Redis\ListPushTailX',
-            'LPUSHX' => 'Predis\Command\Redis\ListPushHeadX',
-            'LINSERT' => 'Predis\Command\Redis\ListInsert',
-            'BRPOPLPUSH' => 'Predis\Command\Redis\ListPopLastPushHeadBlocking',
-
-            /* commands operating on sorted sets */
-            'ZREVRANGEBYSCORE' => 'Predis\Command\Redis\ZSetReverseRangeByScore',
-
-            /* transactions */
-            'WATCH' => 'Predis\Command\Redis\TransactionWatch',
-            'UNWATCH' => 'Predis\Command\Redis\TransactionUnwatch',
-
-            /* remote server control commands */
-            'OBJECT' => 'Predis\Command\Redis\ServerObject',
-            'SLOWLOG' => 'Predis\Command\Redis\ServerSlowlog',
-
-            /* ---------------- Redis 2.4 ---------------- */
-
-            /* remote server control commands */
-            'CLIENT' => 'Predis\Command\Redis\ServerClient',
-
-            /* ---------------- Redis 2.6 ---------------- */
-
-            /* commands operating on the key space */
-            'PTTL' => 'Predis\Command\Redis\KeyPreciseTimeToLive',
-            'PEXPIRE' => 'Predis\Command\Redis\KeyPreciseExpire',
-            'PEXPIREAT' => 'Predis\Command\Redis\KeyPreciseExpireAt',
-            'MIGRATE' => 'Predis\Command\Redis\KeyMigrate',
-
-            /* commands operating on string values */
-            'PSETEX' => 'Predis\Command\Redis\StringPreciseSetExpire',
-            'INCRBYFLOAT' => 'Predis\Command\Redis\StringIncrementByFloat',
-            'BITOP' => 'Predis\Command\Redis\StringBitOp',
-            'BITCOUNT' => 'Predis\Command\Redis\StringBitCount',
-
-            /* commands operating on hashes */
-            'HINCRBYFLOAT' => 'Predis\Command\Redis\HashIncrementByFloat',
-
-            /* scripting */
-            'EVAL' => 'Predis\Command\Redis\ServerEval',
-            'EVALSHA' => 'Predis\Command\Redis\ServerEvalSHA',
-            'SCRIPT' => 'Predis\Command\Redis\ServerScript',
-
-            /* remote server control commands */
-            'TIME' => 'Predis\Command\Redis\ServerTime',
-            'SENTINEL' => 'Predis\Command\Redis\ServerSentinel',
-        );
-    }
-}

+ 0 - 267
src/Profile/RedisVersion280.php

@@ -1,267 +0,0 @@
-<?php
-
-/*
- * This file is part of the Predis package.
- *
- * (c) Daniele Alessandri <suppakilla@gmail.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Predis\Profile;
-
-/**
- * Server profile for Redis 2.8.
- *
- * @author Daniele Alessandri <suppakilla@gmail.com>
- */
-class RedisVersion280 extends RedisProfile
-{
-    /**
-     * {@inheritdoc}
-     */
-    public function getVersion()
-    {
-        return '2.8';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getSupportedCommands()
-    {
-        return array(
-            /* ---------------- Redis 1.2 ---------------- */
-
-            /* commands operating on the key space */
-            'EXISTS' => 'Predis\Command\Redis\KeyExists',
-            'DEL' => 'Predis\Command\Redis\KeyDelete',
-            'TYPE' => 'Predis\Command\Redis\KeyType',
-            'KEYS' => 'Predis\Command\Redis\KeyKeys',
-            'RANDOMKEY' => 'Predis\Command\Redis\KeyRandom',
-            'RENAME' => 'Predis\Command\Redis\KeyRename',
-            'RENAMENX' => 'Predis\Command\Redis\KeyRenamePreserve',
-            'EXPIRE' => 'Predis\Command\Redis\KeyExpire',
-            'EXPIREAT' => 'Predis\Command\Redis\KeyExpireAt',
-            'TTL' => 'Predis\Command\Redis\KeyTimeToLive',
-            'MOVE' => 'Predis\Command\Redis\KeyMove',
-            'SORT' => 'Predis\Command\Redis\KeySort',
-            'DUMP' => 'Predis\Command\Redis\KeyDump',
-            'RESTORE' => 'Predis\Command\Redis\KeyRestore',
-
-            /* commands operating on string values */
-            'SET' => 'Predis\Command\Redis\StringSet',
-            'SETNX' => 'Predis\Command\Redis\StringSetPreserve',
-            'MSET' => 'Predis\Command\Redis\StringSetMultiple',
-            'MSETNX' => 'Predis\Command\Redis\StringSetMultiplePreserve',
-            'GET' => 'Predis\Command\Redis\StringGet',
-            'MGET' => 'Predis\Command\Redis\StringGetMultiple',
-            'GETSET' => 'Predis\Command\Redis\StringGetSet',
-            'INCR' => 'Predis\Command\Redis\StringIncrement',
-            'INCRBY' => 'Predis\Command\Redis\StringIncrementBy',
-            'DECR' => 'Predis\Command\Redis\StringDecrement',
-            'DECRBY' => 'Predis\Command\Redis\StringDecrementBy',
-
-            /* commands operating on lists */
-            'RPUSH' => 'Predis\Command\Redis\ListPushTail',
-            'LPUSH' => 'Predis\Command\Redis\ListPushHead',
-            'LLEN' => 'Predis\Command\Redis\ListLength',
-            'LRANGE' => 'Predis\Command\Redis\ListRange',
-            'LTRIM' => 'Predis\Command\Redis\ListTrim',
-            'LINDEX' => 'Predis\Command\Redis\ListIndex',
-            'LSET' => 'Predis\Command\Redis\ListSet',
-            'LREM' => 'Predis\Command\Redis\ListRemove',
-            'LPOP' => 'Predis\Command\Redis\ListPopFirst',
-            'RPOP' => 'Predis\Command\Redis\ListPopLast',
-            'RPOPLPUSH' => 'Predis\Command\Redis\ListPopLastPushHead',
-
-            /* commands operating on sets */
-            'SADD' => 'Predis\Command\Redis\SetAdd',
-            'SREM' => 'Predis\Command\Redis\SetRemove',
-            'SPOP' => 'Predis\Command\Redis\SetPop',
-            'SMOVE' => 'Predis\Command\Redis\SetMove',
-            'SCARD' => 'Predis\Command\Redis\SetCardinality',
-            'SISMEMBER' => 'Predis\Command\Redis\SetIsMember',
-            'SINTER' => 'Predis\Command\Redis\SetIntersection',
-            'SINTERSTORE' => 'Predis\Command\Redis\SetIntersectionStore',
-            'SUNION' => 'Predis\Command\Redis\SetUnion',
-            'SUNIONSTORE' => 'Predis\Command\Redis\SetUnionStore',
-            'SDIFF' => 'Predis\Command\Redis\SetDifference',
-            'SDIFFSTORE' => 'Predis\Command\Redis\SetDifferenceStore',
-            'SMEMBERS' => 'Predis\Command\Redis\SetMembers',
-            'SRANDMEMBER' => 'Predis\Command\Redis\SetRandomMember',
-
-            /* commands operating on sorted sets */
-            'ZADD' => 'Predis\Command\Redis\ZSetAdd',
-            'ZINCRBY' => 'Predis\Command\Redis\ZSetIncrementBy',
-            'ZREM' => 'Predis\Command\Redis\ZSetRemove',
-            'ZRANGE' => 'Predis\Command\Redis\ZSetRange',
-            'ZREVRANGE' => 'Predis\Command\Redis\ZSetReverseRange',
-            'ZRANGEBYSCORE' => 'Predis\Command\Redis\ZSetRangeByScore',
-            'ZCARD' => 'Predis\Command\Redis\ZSetCardinality',
-            'ZSCORE' => 'Predis\Command\Redis\ZSetScore',
-            'ZREMRANGEBYSCORE' => 'Predis\Command\Redis\ZSetRemoveRangeByScore',
-
-            /* connection related commands */
-            'PING' => 'Predis\Command\Redis\ConnectionPing',
-            'AUTH' => 'Predis\Command\Redis\ConnectionAuth',
-            'SELECT' => 'Predis\Command\Redis\ConnectionSelect',
-            'ECHO' => 'Predis\Command\Redis\ConnectionEcho',
-            'QUIT' => 'Predis\Command\Redis\ConnectionQuit',
-
-            /* remote server control commands */
-            'INFO' => 'Predis\Command\Redis\ServerInfoV26x',
-            'SLAVEOF' => 'Predis\Command\Redis\ServerSlaveOf',
-            'MONITOR' => 'Predis\Command\Redis\ServerMonitor',
-            'DBSIZE' => 'Predis\Command\Redis\ServerDatabaseSize',
-            'FLUSHDB' => 'Predis\Command\Redis\ServerFlushDatabase',
-            'FLUSHALL' => 'Predis\Command\Redis\ServerFlushAll',
-            'SAVE' => 'Predis\Command\Redis\ServerSave',
-            'BGSAVE' => 'Predis\Command\Redis\ServerBackgroundSave',
-            'LASTSAVE' => 'Predis\Command\Redis\ServerLastSave',
-            'SHUTDOWN' => 'Predis\Command\Redis\ServerShutdown',
-            'BGREWRITEAOF' => 'Predis\Command\Redis\ServerBackgroundRewriteAOF',
-
-            /* ---------------- Redis 2.0 ---------------- */
-
-            /* commands operating on string values */
-            'SETEX' => 'Predis\Command\Redis\StringSetExpire',
-            'APPEND' => 'Predis\Command\Redis\StringAppend',
-            'SUBSTR' => 'Predis\Command\Redis\StringSubstr',
-
-            /* commands operating on lists */
-            'BLPOP' => 'Predis\Command\Redis\ListPopFirstBlocking',
-            'BRPOP' => 'Predis\Command\Redis\ListPopLastBlocking',
-
-            /* commands operating on sorted sets */
-            'ZUNIONSTORE' => 'Predis\Command\Redis\ZSetUnionStore',
-            'ZINTERSTORE' => 'Predis\Command\Redis\ZSetIntersectionStore',
-            'ZCOUNT' => 'Predis\Command\Redis\ZSetCount',
-            'ZRANK' => 'Predis\Command\Redis\ZSetRank',
-            'ZREVRANK' => 'Predis\Command\Redis\ZSetReverseRank',
-            'ZREMRANGEBYRANK' => 'Predis\Command\Redis\ZSetRemoveRangeByRank',
-
-            /* commands operating on hashes */
-            'HSET' => 'Predis\Command\Redis\HashSet',
-            'HSETNX' => 'Predis\Command\Redis\HashSetPreserve',
-            'HMSET' => 'Predis\Command\Redis\HashSetMultiple',
-            'HINCRBY' => 'Predis\Command\Redis\HashIncrementBy',
-            'HGET' => 'Predis\Command\Redis\HashGet',
-            'HMGET' => 'Predis\Command\Redis\HashGetMultiple',
-            'HDEL' => 'Predis\Command\Redis\HashDelete',
-            'HEXISTS' => 'Predis\Command\Redis\HashExists',
-            'HLEN' => 'Predis\Command\Redis\HashLength',
-            'HKEYS' => 'Predis\Command\Redis\HashKeys',
-            'HVALS' => 'Predis\Command\Redis\HashValues',
-            'HGETALL' => 'Predis\Command\Redis\HashGetAll',
-
-            /* transactions */
-            'MULTI' => 'Predis\Command\Redis\TransactionMulti',
-            'EXEC' => 'Predis\Command\Redis\TransactionExec',
-            'DISCARD' => 'Predis\Command\Redis\TransactionDiscard',
-
-            /* publish - subscribe */
-            'SUBSCRIBE' => 'Predis\Command\Redis\PubSubSubscribe',
-            'UNSUBSCRIBE' => 'Predis\Command\Redis\PubSubUnsubscribe',
-            'PSUBSCRIBE' => 'Predis\Command\Redis\PubSubSubscribeByPattern',
-            'PUNSUBSCRIBE' => 'Predis\Command\Redis\PubSubUnsubscribeByPattern',
-            'PUBLISH' => 'Predis\Command\Redis\PubSubPublish',
-
-            /* remote server control commands */
-            'CONFIG' => 'Predis\Command\Redis\ServerConfig',
-
-            /* ---------------- Redis 2.2 ---------------- */
-
-            /* commands operating on the key space */
-            'PERSIST' => 'Predis\Command\Redis\KeyPersist',
-
-            /* commands operating on string values */
-            'STRLEN' => 'Predis\Command\Redis\StringStrlen',
-            'SETRANGE' => 'Predis\Command\Redis\StringSetRange',
-            'GETRANGE' => 'Predis\Command\Redis\StringGetRange',
-            'SETBIT' => 'Predis\Command\Redis\StringSetBit',
-            'GETBIT' => 'Predis\Command\Redis\StringGetBit',
-
-            /* commands operating on lists */
-            'RPUSHX' => 'Predis\Command\Redis\ListPushTailX',
-            'LPUSHX' => 'Predis\Command\Redis\ListPushHeadX',
-            'LINSERT' => 'Predis\Command\Redis\ListInsert',
-            'BRPOPLPUSH' => 'Predis\Command\Redis\ListPopLastPushHeadBlocking',
-
-            /* commands operating on sorted sets */
-            'ZREVRANGEBYSCORE' => 'Predis\Command\Redis\ZSetReverseRangeByScore',
-
-            /* transactions */
-            'WATCH' => 'Predis\Command\Redis\TransactionWatch',
-            'UNWATCH' => 'Predis\Command\Redis\TransactionUnwatch',
-
-            /* remote server control commands */
-            'OBJECT' => 'Predis\Command\Redis\ServerObject',
-            'SLOWLOG' => 'Predis\Command\Redis\ServerSlowlog',
-
-            /* ---------------- Redis 2.4 ---------------- */
-
-            /* remote server control commands */
-            'CLIENT' => 'Predis\Command\Redis\ServerClient',
-
-            /* ---------------- Redis 2.6 ---------------- */
-
-            /* commands operating on the key space */
-            'PTTL' => 'Predis\Command\Redis\KeyPreciseTimeToLive',
-            'PEXPIRE' => 'Predis\Command\Redis\KeyPreciseExpire',
-            'PEXPIREAT' => 'Predis\Command\Redis\KeyPreciseExpireAt',
-            'MIGRATE' => 'Predis\Command\Redis\KeyMigrate',
-
-            /* commands operating on string values */
-            'PSETEX' => 'Predis\Command\Redis\StringPreciseSetExpire',
-            'INCRBYFLOAT' => 'Predis\Command\Redis\StringIncrementByFloat',
-            'BITOP' => 'Predis\Command\Redis\StringBitOp',
-            'BITCOUNT' => 'Predis\Command\Redis\StringBitCount',
-
-            /* commands operating on hashes */
-            'HINCRBYFLOAT' => 'Predis\Command\Redis\HashIncrementByFloat',
-
-            /* scripting */
-            'EVAL' => 'Predis\Command\Redis\ServerEval',
-            'EVALSHA' => 'Predis\Command\Redis\ServerEvalSHA',
-            'SCRIPT' => 'Predis\Command\Redis\ServerScript',
-
-            /* remote server control commands */
-            'TIME' => 'Predis\Command\Redis\ServerTime',
-            'SENTINEL' => 'Predis\Command\Redis\ServerSentinel',
-
-            /* ---------------- Redis 2.8 ---------------- */
-
-            /* commands operating on the key space */
-            'SCAN' => 'Predis\Command\Redis\KeyScan',
-
-            /* commands operating on string values */
-            'BITPOS' => 'Predis\Command\Redis\StringBitPos',
-
-            /* commands operating on sets */
-            'SSCAN' => 'Predis\Command\Redis\SetScan',
-
-            /* commands operating on sorted sets */
-            'ZSCAN' => 'Predis\Command\Redis\ZSetScan',
-            'ZLEXCOUNT' => 'Predis\Command\Redis\ZSetLexCount',
-            'ZRANGEBYLEX' => 'Predis\Command\Redis\ZSetRangeByLex',
-            'ZREMRANGEBYLEX' => 'Predis\Command\Redis\ZSetRemoveRangeByLex',
-            'ZREVRANGEBYLEX' => 'Predis\Command\Redis\ZSetReverseRangeByLex',
-
-            /* commands operating on hashes */
-            'HSCAN' => 'Predis\Command\Redis\HashScan',
-
-            /* publish - subscribe */
-            'PUBSUB' => 'Predis\Command\Redis\PubSubPubsub',
-
-            /* commands operating on HyperLogLog */
-            'PFADD' => 'Predis\Command\Redis\HyperLogLogAdd',
-            'PFCOUNT' => 'Predis\Command\Redis\HyperLogLogCount',
-            'PFMERGE' => 'Predis\Command\Redis\HyperLogLogMerge',
-
-            /* remote server control commands */
-            'COMMAND' => 'Predis\Command\Redis\ServerCommand',
-        );
-    }
-}

+ 0 - 270
src/Profile/RedisVersion300.php

@@ -1,270 +0,0 @@
-<?php
-
-/*
- * This file is part of the Predis package.
- *
- * (c) Daniele Alessandri <suppakilla@gmail.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Predis\Profile;
-
-/**
- * Server profile for Redis 3.0.
- *
- * @author Daniele Alessandri <suppakilla@gmail.com>
- */
-class RedisVersion300 extends RedisProfile
-{
-    /**
-     * {@inheritdoc}
-     */
-    public function getVersion()
-    {
-        return '3.0';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getSupportedCommands()
-    {
-        return array(
-            /* ---------------- Redis 1.2 ---------------- */
-
-            /* commands operating on the key space */
-            'EXISTS' => 'Predis\Command\Redis\KeyExists',
-            'DEL' => 'Predis\Command\Redis\KeyDelete',
-            'TYPE' => 'Predis\Command\Redis\KeyType',
-            'KEYS' => 'Predis\Command\Redis\KeyKeys',
-            'RANDOMKEY' => 'Predis\Command\Redis\KeyRandom',
-            'RENAME' => 'Predis\Command\Redis\KeyRename',
-            'RENAMENX' => 'Predis\Command\Redis\KeyRenamePreserve',
-            'EXPIRE' => 'Predis\Command\Redis\KeyExpire',
-            'EXPIREAT' => 'Predis\Command\Redis\KeyExpireAt',
-            'TTL' => 'Predis\Command\Redis\KeyTimeToLive',
-            'MOVE' => 'Predis\Command\Redis\KeyMove',
-            'SORT' => 'Predis\Command\Redis\KeySort',
-            'DUMP' => 'Predis\Command\Redis\KeyDump',
-            'RESTORE' => 'Predis\Command\Redis\KeyRestore',
-
-            /* commands operating on string values */
-            'SET' => 'Predis\Command\Redis\StringSet',
-            'SETNX' => 'Predis\Command\Redis\StringSetPreserve',
-            'MSET' => 'Predis\Command\Redis\StringSetMultiple',
-            'MSETNX' => 'Predis\Command\Redis\StringSetMultiplePreserve',
-            'GET' => 'Predis\Command\Redis\StringGet',
-            'MGET' => 'Predis\Command\Redis\StringGetMultiple',
-            'GETSET' => 'Predis\Command\Redis\StringGetSet',
-            'INCR' => 'Predis\Command\Redis\StringIncrement',
-            'INCRBY' => 'Predis\Command\Redis\StringIncrementBy',
-            'DECR' => 'Predis\Command\Redis\StringDecrement',
-            'DECRBY' => 'Predis\Command\Redis\StringDecrementBy',
-
-            /* commands operating on lists */
-            'RPUSH' => 'Predis\Command\Redis\ListPushTail',
-            'LPUSH' => 'Predis\Command\Redis\ListPushHead',
-            'LLEN' => 'Predis\Command\Redis\ListLength',
-            'LRANGE' => 'Predis\Command\Redis\ListRange',
-            'LTRIM' => 'Predis\Command\Redis\ListTrim',
-            'LINDEX' => 'Predis\Command\Redis\ListIndex',
-            'LSET' => 'Predis\Command\Redis\ListSet',
-            'LREM' => 'Predis\Command\Redis\ListRemove',
-            'LPOP' => 'Predis\Command\Redis\ListPopFirst',
-            'RPOP' => 'Predis\Command\Redis\ListPopLast',
-            'RPOPLPUSH' => 'Predis\Command\Redis\ListPopLastPushHead',
-
-            /* commands operating on sets */
-            'SADD' => 'Predis\Command\Redis\SetAdd',
-            'SREM' => 'Predis\Command\Redis\SetRemove',
-            'SPOP' => 'Predis\Command\Redis\SetPop',
-            'SMOVE' => 'Predis\Command\Redis\SetMove',
-            'SCARD' => 'Predis\Command\Redis\SetCardinality',
-            'SISMEMBER' => 'Predis\Command\Redis\SetIsMember',
-            'SINTER' => 'Predis\Command\Redis\SetIntersection',
-            'SINTERSTORE' => 'Predis\Command\Redis\SetIntersectionStore',
-            'SUNION' => 'Predis\Command\Redis\SetUnion',
-            'SUNIONSTORE' => 'Predis\Command\Redis\SetUnionStore',
-            'SDIFF' => 'Predis\Command\Redis\SetDifference',
-            'SDIFFSTORE' => 'Predis\Command\Redis\SetDifferenceStore',
-            'SMEMBERS' => 'Predis\Command\Redis\SetMembers',
-            'SRANDMEMBER' => 'Predis\Command\Redis\SetRandomMember',
-
-            /* commands operating on sorted sets */
-            'ZADD' => 'Predis\Command\Redis\ZSetAdd',
-            'ZINCRBY' => 'Predis\Command\Redis\ZSetIncrementBy',
-            'ZREM' => 'Predis\Command\Redis\ZSetRemove',
-            'ZRANGE' => 'Predis\Command\Redis\ZSetRange',
-            'ZREVRANGE' => 'Predis\Command\Redis\ZSetReverseRange',
-            'ZRANGEBYSCORE' => 'Predis\Command\Redis\ZSetRangeByScore',
-            'ZCARD' => 'Predis\Command\Redis\ZSetCardinality',
-            'ZSCORE' => 'Predis\Command\Redis\ZSetScore',
-            'ZREMRANGEBYSCORE' => 'Predis\Command\Redis\ZSetRemoveRangeByScore',
-
-            /* connection related commands */
-            'PING' => 'Predis\Command\Redis\ConnectionPing',
-            'AUTH' => 'Predis\Command\Redis\ConnectionAuth',
-            'SELECT' => 'Predis\Command\Redis\ConnectionSelect',
-            'ECHO' => 'Predis\Command\Redis\ConnectionEcho',
-            'QUIT' => 'Predis\Command\Redis\ConnectionQuit',
-
-            /* remote server control commands */
-            'INFO' => 'Predis\Command\Redis\ServerInfoV26x',
-            'SLAVEOF' => 'Predis\Command\Redis\ServerSlaveOf',
-            'MONITOR' => 'Predis\Command\Redis\ServerMonitor',
-            'DBSIZE' => 'Predis\Command\Redis\ServerDatabaseSize',
-            'FLUSHDB' => 'Predis\Command\Redis\ServerFlushDatabase',
-            'FLUSHALL' => 'Predis\Command\Redis\ServerFlushAll',
-            'SAVE' => 'Predis\Command\Redis\ServerSave',
-            'BGSAVE' => 'Predis\Command\Redis\ServerBackgroundSave',
-            'LASTSAVE' => 'Predis\Command\Redis\ServerLastSave',
-            'SHUTDOWN' => 'Predis\Command\Redis\ServerShutdown',
-            'BGREWRITEAOF' => 'Predis\Command\Redis\ServerBackgroundRewriteAOF',
-
-            /* ---------------- Redis 2.0 ---------------- */
-
-            /* commands operating on string values */
-            'SETEX' => 'Predis\Command\Redis\StringSetExpire',
-            'APPEND' => 'Predis\Command\Redis\StringAppend',
-            'SUBSTR' => 'Predis\Command\Redis\StringSubstr',
-
-            /* commands operating on lists */
-            'BLPOP' => 'Predis\Command\Redis\ListPopFirstBlocking',
-            'BRPOP' => 'Predis\Command\Redis\ListPopLastBlocking',
-
-            /* commands operating on sorted sets */
-            'ZUNIONSTORE' => 'Predis\Command\Redis\ZSetUnionStore',
-            'ZINTERSTORE' => 'Predis\Command\Redis\ZSetIntersectionStore',
-            'ZCOUNT' => 'Predis\Command\Redis\ZSetCount',
-            'ZRANK' => 'Predis\Command\Redis\ZSetRank',
-            'ZREVRANK' => 'Predis\Command\Redis\ZSetReverseRank',
-            'ZREMRANGEBYRANK' => 'Predis\Command\Redis\ZSetRemoveRangeByRank',
-
-            /* commands operating on hashes */
-            'HSET' => 'Predis\Command\Redis\HashSet',
-            'HSETNX' => 'Predis\Command\Redis\HashSetPreserve',
-            'HMSET' => 'Predis\Command\Redis\HashSetMultiple',
-            'HINCRBY' => 'Predis\Command\Redis\HashIncrementBy',
-            'HGET' => 'Predis\Command\Redis\HashGet',
-            'HMGET' => 'Predis\Command\Redis\HashGetMultiple',
-            'HDEL' => 'Predis\Command\Redis\HashDelete',
-            'HEXISTS' => 'Predis\Command\Redis\HashExists',
-            'HLEN' => 'Predis\Command\Redis\HashLength',
-            'HKEYS' => 'Predis\Command\Redis\HashKeys',
-            'HVALS' => 'Predis\Command\Redis\HashValues',
-            'HGETALL' => 'Predis\Command\Redis\HashGetAll',
-
-            /* transactions */
-            'MULTI' => 'Predis\Command\Redis\TransactionMulti',
-            'EXEC' => 'Predis\Command\Redis\TransactionExec',
-            'DISCARD' => 'Predis\Command\Redis\TransactionDiscard',
-
-            /* publish - subscribe */
-            'SUBSCRIBE' => 'Predis\Command\Redis\PubSubSubscribe',
-            'UNSUBSCRIBE' => 'Predis\Command\Redis\PubSubUnsubscribe',
-            'PSUBSCRIBE' => 'Predis\Command\Redis\PubSubSubscribeByPattern',
-            'PUNSUBSCRIBE' => 'Predis\Command\Redis\PubSubUnsubscribeByPattern',
-            'PUBLISH' => 'Predis\Command\Redis\PubSubPublish',
-
-            /* remote server control commands */
-            'CONFIG' => 'Predis\Command\Redis\ServerConfig',
-
-            /* ---------------- Redis 2.2 ---------------- */
-
-            /* commands operating on the key space */
-            'PERSIST' => 'Predis\Command\Redis\KeyPersist',
-
-            /* commands operating on string values */
-            'STRLEN' => 'Predis\Command\Redis\StringStrlen',
-            'SETRANGE' => 'Predis\Command\Redis\StringSetRange',
-            'GETRANGE' => 'Predis\Command\Redis\StringGetRange',
-            'SETBIT' => 'Predis\Command\Redis\StringSetBit',
-            'GETBIT' => 'Predis\Command\Redis\StringGetBit',
-
-            /* commands operating on lists */
-            'RPUSHX' => 'Predis\Command\Redis\ListPushTailX',
-            'LPUSHX' => 'Predis\Command\Redis\ListPushHeadX',
-            'LINSERT' => 'Predis\Command\Redis\ListInsert',
-            'BRPOPLPUSH' => 'Predis\Command\Redis\ListPopLastPushHeadBlocking',
-
-            /* commands operating on sorted sets */
-            'ZREVRANGEBYSCORE' => 'Predis\Command\Redis\ZSetReverseRangeByScore',
-
-            /* transactions */
-            'WATCH' => 'Predis\Command\Redis\TransactionWatch',
-            'UNWATCH' => 'Predis\Command\Redis\TransactionUnwatch',
-
-            /* remote server control commands */
-            'OBJECT' => 'Predis\Command\Redis\ServerObject',
-            'SLOWLOG' => 'Predis\Command\Redis\ServerSlowlog',
-
-            /* ---------------- Redis 2.4 ---------------- */
-
-            /* remote server control commands */
-            'CLIENT' => 'Predis\Command\Redis\ServerClient',
-
-            /* ---------------- Redis 2.6 ---------------- */
-
-            /* commands operating on the key space */
-            'PTTL' => 'Predis\Command\Redis\KeyPreciseTimeToLive',
-            'PEXPIRE' => 'Predis\Command\Redis\KeyPreciseExpire',
-            'PEXPIREAT' => 'Predis\Command\Redis\KeyPreciseExpireAt',
-            'MIGRATE' => 'Predis\Command\Redis\KeyMigrate',
-
-            /* commands operating on string values */
-            'PSETEX' => 'Predis\Command\Redis\StringPreciseSetExpire',
-            'INCRBYFLOAT' => 'Predis\Command\Redis\StringIncrementByFloat',
-            'BITOP' => 'Predis\Command\Redis\StringBitOp',
-            'BITCOUNT' => 'Predis\Command\Redis\StringBitCount',
-
-            /* commands operating on hashes */
-            'HINCRBYFLOAT' => 'Predis\Command\Redis\HashIncrementByFloat',
-
-            /* scripting */
-            'EVAL' => 'Predis\Command\Redis\ServerEval',
-            'EVALSHA' => 'Predis\Command\Redis\ServerEvalSHA',
-            'SCRIPT' => 'Predis\Command\Redis\ServerScript',
-
-            /* remote server control commands */
-            'TIME' => 'Predis\Command\Redis\ServerTime',
-            'SENTINEL' => 'Predis\Command\Redis\ServerSentinel',
-
-            /* ---------------- Redis 2.8 ---------------- */
-
-            /* commands operating on the key space */
-            'SCAN' => 'Predis\Command\Redis\KeyScan',
-
-            /* commands operating on string values */
-            'BITPOS' => 'Predis\Command\Redis\StringBitPos',
-
-            /* commands operating on sets */
-            'SSCAN' => 'Predis\Command\Redis\SetScan',
-
-            /* commands operating on sorted sets */
-            'ZSCAN' => 'Predis\Command\Redis\ZSetScan',
-            'ZLEXCOUNT' => 'Predis\Command\Redis\ZSetLexCount',
-            'ZRANGEBYLEX' => 'Predis\Command\Redis\ZSetRangeByLex',
-            'ZREMRANGEBYLEX' => 'Predis\Command\Redis\ZSetRemoveRangeByLex',
-            'ZREVRANGEBYLEX' => 'Predis\Command\Redis\ZSetReverseRangeByLex',
-
-            /* commands operating on hashes */
-            'HSCAN' => 'Predis\Command\Redis\HashScan',
-
-            /* publish - subscribe */
-            'PUBSUB' => 'Predis\Command\Redis\PubSubPubsub',
-
-            /* commands operating on HyperLogLog */
-            'PFADD' => 'Predis\Command\Redis\HyperLogLogAdd',
-            'PFCOUNT' => 'Predis\Command\Redis\HyperLogLogCount',
-            'PFMERGE' => 'Predis\Command\Redis\HyperLogLogMerge',
-
-            /* remote server control commands */
-            'COMMAND' => 'Predis\Command\Redis\ServerCommand',
-
-            /* ---------------- Redis 3.0 ---------------- */
-
-        );
-    }
-}

+ 2 - 2
src/PubSub/Consumer.php

@@ -70,9 +70,9 @@ class Consumer extends AbstractConsumer
 
         $commands = array('publish', 'subscribe', 'unsubscribe', 'psubscribe', 'punsubscribe');
 
-        if ($client->getProfile()->supportsCommands($commands) === false) {
+        if ($client->getCommandFactory()->supportsCommands($commands) === false) {
             throw new NotSupportedException(
-                'The current profile does not support PUB/SUB related commands.'
+                'PUB/SUB commands are not supported by the current command factory.'
             );
         }
     }

+ 6 - 6
src/Transaction/MultiExec.php

@@ -72,9 +72,9 @@ class MultiExec implements ClientContextInterface
             );
         }
 
-        if (!$client->getProfile()->supportsCommands(array('MULTI', 'EXEC', 'DISCARD'))) {
+        if (!$client->getCommandFactory()->supportsCommands(array('MULTI', 'EXEC', 'DISCARD'))) {
             throw new NotSupportedException(
-                'The current profile does not support MULTI, EXEC and DISCARD.'
+                'MULTI, EXEC and DISCARD are not supported by the current command factory.'
             );
         }
     }
@@ -228,8 +228,8 @@ class MultiExec implements ClientContextInterface
      */
     public function watch($keys)
     {
-        if (!$this->client->getProfile()->supportsCommand('WATCH')) {
-            throw new NotSupportedException('WATCH is not supported by the current profile.');
+        if (!$this->client->getCommandFactory()->supportsCommand('WATCH')) {
+            throw new NotSupportedException('WATCH is not supported by the current command factory.');
         }
 
         if ($this->state->isWatchAllowed()) {
@@ -268,9 +268,9 @@ class MultiExec implements ClientContextInterface
      */
     public function unwatch()
     {
-        if (!$this->client->getProfile()->supportsCommand('UNWATCH')) {
+        if (!$this->client->getCommandFactory()->supportsCommand('UNWATCH')) {
             throw new NotSupportedException(
-                'UNWATCH is not supported by the current profile.'
+                'UNWATCH is not supported by the current command factory.'
             );
         }
 

+ 3 - 4
tests/PHPUnit/PredisCommandTestCase.php

@@ -13,7 +13,6 @@ namespace Predis\Command\Redis;
 
 use Predis\Client;
 use Predis\Command;
-use Predis\Profile;
 use PredisTestCase;
 
 /**
@@ -56,11 +55,11 @@ abstract class PredisCommandTestCase extends PredisTestCase
      */
     public function getClient($flushdb = true)
     {
-        $profile = $this->getProfile();
+        $commands = $this->getCommandFactory();
 
-        if (!$profile->supportsCommand($id = $this->getExpectedId())) {
+        if (!$commands->supportsCommand($id = $this->getExpectedId())) {
             $this->markTestSkipped(
-                "The profile {$profile->getVersion()} does not support command {$id}"
+                "The current command factory does not support command $id"
             );
         }
 

+ 46 - 46
tests/PHPUnit/PredisConnectionTestCase.php

@@ -205,9 +205,9 @@ abstract class PredisConnectionTestCase extends PredisTestCase
     public function testSendingCommandForcesConnection()
     {
         $connection = $this->createConnection();
-        $profile = $this->getCurrentProfile();
+        $commands = $this->getCommandFactory();
 
-        $cmdPing = $profile->createCommand('ping');
+        $cmdPing = $commands->createCommand('ping');
 
         $this->assertEquals('PONG', $connection->executeCommand($cmdPing));
         $this->assertTrue($connection->isConnected());
@@ -218,9 +218,9 @@ abstract class PredisConnectionTestCase extends PredisTestCase
      */
     public function testExecutesCommandOnServer()
     {
-        $profile = $this->getCurrentProfile();
+        $commands = $this->getCommandFactory();
 
-        $cmdPing = $this->getMock($profile->getCommandClass('ping'), array('parseResponse'));
+        $cmdPing = $this->getMock($commands->getCommandClass('ping'), array('parseResponse'));
         $cmdPing->expects($this->never())
                 ->method('parseResponse');
 
@@ -234,8 +234,8 @@ abstract class PredisConnectionTestCase extends PredisTestCase
      */
     public function testExecutesCommandWithHolesInArguments()
     {
-        $profile = $this->getCurrentProfile();
-        $cmdDel = $profile->createCommand('mget', array(0 => 'key:0', 2 => 'key:2'));
+        $commands = $this->getCommandFactory();
+        $cmdDel = $commands->createCommand('mget', array(0 => 'key:0', 2 => 'key:2'));
 
         $connection = $this->createConnection();
 
@@ -247,13 +247,13 @@ abstract class PredisConnectionTestCase extends PredisTestCase
      */
     public function testExecutesMultipleCommandsOnServer()
     {
-        $profile = $this->getCurrentProfile();
+        $commands = $this->getCommandFactory();
 
-        $cmdPing = $profile->createCommand('ping');
-        $cmdEcho = $profile->createCommand('echo', array('echoed'));
-        $cmdGet = $profile->createCommand('get', array('foobar'));
-        $cmdRpush = $profile->createCommand('rpush', array('metavars', 'foo', 'hoge', 'lol'));
-        $cmdLrange = $profile->createCommand('lrange', array('metavars', 0, -1));
+        $cmdPing = $commands->createCommand('ping');
+        $cmdEcho = $commands->createCommand('echo', array('echoed'));
+        $cmdGet = $commands->createCommand('get', array('foobar'));
+        $cmdRpush = $commands->createCommand('rpush', array('metavars', 'foo', 'hoge', 'lol'));
+        $cmdLrange = $commands->createCommand('lrange', array('metavars', 0, -1));
 
         $connection = $this->createConnection(true);
 
@@ -269,9 +269,9 @@ abstract class PredisConnectionTestCase extends PredisTestCase
      */
     public function testWritesCommandToServer()
     {
-        $profile = $this->getCurrentProfile();
+        $commands = $this->getCommandFactory();
 
-        $cmdEcho = $this->getMock($profile->getCommandClass('echo'), array('parseResponse'));
+        $cmdEcho = $this->getMock($commands->getCommandClass('echo'), array('parseResponse'));
         $cmdEcho->setArguments(array('ECHOED'));
         $cmdEcho->expects($this->never())
                 ->method('parseResponse');
@@ -286,9 +286,9 @@ abstract class PredisConnectionTestCase extends PredisTestCase
      */
     public function testReadsCommandFromServer()
     {
-        $profile = $this->getCurrentProfile();
+        $commands = $this->getCommandFactory();
 
-        $cmdEcho = $this->getMock($profile->getCommandClass('echo'), array('parseResponse'));
+        $cmdEcho = $this->getMock($commands->getCommandClass('echo'), array('parseResponse'));
         $cmdEcho->setArguments(array('ECHOED'));
         $cmdEcho->expects($this->never())
                 ->method('parseResponse');
@@ -304,13 +304,13 @@ abstract class PredisConnectionTestCase extends PredisTestCase
      */
     public function testIsAbleToWriteMultipleCommandsAndReadThemBackForPipelining()
     {
-        $profile = $this->getCurrentProfile();
+        $commands = $this->getCommandFactory();
 
-        $cmdPing = $this->getMock($profile->getCommandClass('ping'), array('parseResponse'));
+        $cmdPing = $this->getMock($commands->getCommandClass('ping'), array('parseResponse'));
         $cmdPing->expects($this->never())
                 ->method('parseResponse');
 
-        $cmdEcho = $this->getMock($profile->getCommandClass('echo'), array('parseResponse'));
+        $cmdEcho = $this->getMock($commands->getCommandClass('echo'), array('parseResponse'));
         $cmdEcho->setArguments(array('ECHOED'));
         $cmdEcho->expects($this->never())
                 ->method('parseResponse');
@@ -329,14 +329,14 @@ abstract class PredisConnectionTestCase extends PredisTestCase
      */
     public function testSendsInitializationCommandsOnConnection()
     {
-        $profile = $this->getCurrentProfile();
+        $commands = $this->getCommandFactory();
 
-        $cmdPing = $this->getMock($profile->getCommandClass('ping'), array('getArguments'));
+        $cmdPing = $this->getMock($commands->getCommandClass('ping'), array('getArguments'));
         $cmdPing->expects($this->once())
                 ->method('getArguments')
                 ->will($this->returnValue(array()));
 
-        $cmdEcho = $this->getMock($profile->getCommandClass('echo'), array('getArguments'));
+        $cmdEcho = $this->getMock($commands->getCommandClass('echo'), array('getArguments'));
         $cmdEcho->expects($this->once())
                 ->method('getArguments')
                 ->will($this->returnValue(array('ECHOED')));
@@ -353,17 +353,17 @@ abstract class PredisConnectionTestCase extends PredisTestCase
      */
     public function testReadsStatusResponses()
     {
-        $profile = $this->getCurrentProfile();
+        $commands = $this->getCommandFactory();
         $connection = $this->createConnection(true);
 
-        $connection->writeRequest($profile->createCommand('set', array('foo', 'bar')));
+        $connection->writeRequest($commands->createCommand('set', array('foo', 'bar')));
         $this->assertInstanceOf('Predis\Response\Status', $connection->read());
 
-        $connection->writeRequest($profile->createCommand('ping'));
+        $connection->writeRequest($commands->createCommand('ping'));
         $this->assertInstanceOf('Predis\Response\Status', $connection->read());
 
-        $connection->writeRequest($profile->createCommand('multi'));
-        $connection->writeRequest($profile->createCommand('ping'));
+        $connection->writeRequest($commands->createCommand('multi'));
+        $connection->writeRequest($commands->createCommand('ping'));
         $this->assertInstanceOf('Predis\Response\Status', $connection->read());
         $this->assertInstanceOf('Predis\Response\Status', $connection->read());
     }
@@ -373,15 +373,15 @@ abstract class PredisConnectionTestCase extends PredisTestCase
      */
     public function testReadsBulkResponses()
     {
-        $profile = $this->getCurrentProfile();
+        $commands = $this->getCommandFactory();
         $connection = $this->createConnection(true);
 
-        $connection->executeCommand($profile->createCommand('set', array('foo', 'bar')));
+        $connection->executeCommand($commands->createCommand('set', array('foo', 'bar')));
 
-        $connection->writeRequest($profile->createCommand('get', array('foo')));
+        $connection->writeRequest($commands->createCommand('get', array('foo')));
         $this->assertSame('bar', $connection->read());
 
-        $connection->writeRequest($profile->createCommand('get', array('hoge')));
+        $connection->writeRequest($commands->createCommand('get', array('hoge')));
         $this->assertNull($connection->read());
     }
 
@@ -390,11 +390,11 @@ abstract class PredisConnectionTestCase extends PredisTestCase
      */
     public function testReadsIntegerResponses()
     {
-        $profile = $this->getCurrentProfile();
+        $commands = $this->getCommandFactory();
         $connection = $this->createConnection(true);
 
-        $connection->executeCommand($profile->createCommand('rpush', array('metavars', 'foo', 'hoge', 'lol')));
-        $connection->writeRequest($profile->createCommand('llen', array('metavars')));
+        $connection->executeCommand($commands->createCommand('rpush', array('metavars', 'foo', 'hoge', 'lol')));
+        $connection->writeRequest($commands->createCommand('llen', array('metavars')));
 
         $this->assertSame(3, $connection->read());
     }
@@ -404,11 +404,11 @@ abstract class PredisConnectionTestCase extends PredisTestCase
      */
     public function testReadsErrorResponsesAsResponseErrorObjects()
     {
-        $profile = $this->getCurrentProfile();
+        $commands = $this->getCommandFactory();
         $connection = $this->createConnection(true);
 
-        $connection->executeCommand($profile->createCommand('set', array('foo', 'bar')));
-        $connection->writeRequest($profile->createCommand('rpush', array('foo', 'baz')));
+        $connection->executeCommand($commands->createCommand('set', array('foo', 'bar')));
+        $connection->writeRequest($commands->createCommand('rpush', array('foo', 'baz')));
 
         $this->assertInstanceOf('Predis\Response\Error', $error = $connection->read());
         $this->assertRegExp('/[ERR|WRONGTYPE] Operation against a key holding the wrong kind of value/', $error->getMessage());
@@ -419,11 +419,11 @@ abstract class PredisConnectionTestCase extends PredisTestCase
      */
     public function testReadsMultibulkResponsesAsArrays()
     {
-        $profile = $this->getCurrentProfile();
+        $commands = $this->getCommandFactory();
         $connection = $this->createConnection(true);
 
-        $connection->executeCommand($profile->createCommand('rpush', array('metavars', 'foo', 'hoge', 'lol')));
-        $connection->writeRequest($profile->createCommand('lrange', array('metavars', 0, -1)));
+        $connection->executeCommand($commands->createCommand('rpush', array('metavars', 'foo', 'hoge', 'lol')));
+        $connection->writeRequest($commands->createCommand('lrange', array('metavars', 0, -1)));
 
         $this->assertSame(array('foo', 'hoge', 'lol'), $connection->read());
     }
@@ -499,13 +499,13 @@ abstract class PredisConnectionTestCase extends PredisTestCase
      */
     public function testThrowsExceptionOnReadWriteTimeout()
     {
-        $profile = $this->getCurrentProfile();
+        $commands = $this->getCommandFactory();
 
         $connection = $this->createConnectionWithParams(array(
             'read_write_timeout' => 0.5,
         ), true);
 
-        $connection->executeCommand($profile->createCommand('brpop', array('foo', 3)));
+        $connection->executeCommand($commands->createCommand('brpop', array('foo', 3)));
     }
 
     /**
@@ -518,7 +518,7 @@ abstract class PredisConnectionTestCase extends PredisTestCase
         $connection = $this->createConnection();
         $stream = $connection->getResource();
 
-        $connection->writeRequest($this->getCurrentProfile()->createCommand('ping'));
+        $connection->writeRequest($this->getCommandFactory()->createCommand('ping'));
         fread($stream, 1);
 
         $connection->read();
@@ -601,7 +601,7 @@ abstract class PredisConnectionTestCase extends PredisTestCase
     protected function createConnectionWithParams($parameters, $initialize = false)
     {
         $class = static::CONNECTION_CLASS;
-        $profile = $this->getCurrentProfile();
+        $commands = $this->getCommandFactory();
 
         if (!$parameters instanceof ParametersInterface) {
             $parameters = $this->getParameters($parameters);
@@ -611,11 +611,11 @@ abstract class PredisConnectionTestCase extends PredisTestCase
 
         if ($initialize) {
             $connection->addConnectCommand(
-                $profile->createCommand('select', array($parameters->database))
+                $commands->createCommand('select', array($parameters->database))
             );
 
             $connection->addConnectCommand(
-                $profile->createCommand('flushdb')
+                $commands->createCommand('flushdb')
             );
         }
 

+ 0 - 282
tests/PHPUnit/PredisProfileTestCase.php

@@ -1,282 +0,0 @@
-<?php
-
-/*
- * This file is part of the Predis package.
- *
- * (c) Daniele Alessandri <suppakilla@gmail.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Predis\Profile;
-
-use Predis\Command\CommandInterface;
-use Predis\Command\Processor\ProcessorChain;
-use PredisTestCase;
-
-/**
- *
- */
-abstract class PredisProfileTestCase extends PredisTestCase
-{
-    /**
-     * Returns a new instance of the tested profile.
-     *
-     * @param string $version Version of Redis.
-     *
-     * @return ProfileInterface
-     */
-    protected function getProfile($version = null)
-    {
-        $this->markTestIncomplete('Server profile must be defined in '.get_class($this));
-    }
-
-    /**
-     * Returns the expected version string for the tested profile.
-     *
-     * @return string Version string.
-     */
-    abstract protected function getExpectedVersion();
-
-    /**
-     * Returns the expected list of commands supported by the tested profile.
-     *
-     * @return array List of supported commands.
-     */
-    abstract protected function getExpectedCommands();
-
-    /**
-     * Returns the list of commands supported by the current
-     * server profile.
-     *
-     * @param ProfileInterface $profile Server profile instance.
-     *
-     * @return array
-     */
-    protected function getCommands(ProfileInterface $profile)
-    {
-        $commands = $profile->getSupportedCommands();
-
-        return array_keys($commands);
-    }
-
-    /**
-     * @group disconnected
-     */
-    public function testGetVersion()
-    {
-        $profile = $this->getProfile();
-
-        $this->assertEquals($this->getExpectedVersion(), $profile->getVersion());
-    }
-
-    /**
-     * @group disconnected
-     */
-    public function testSupportedCommands()
-    {
-        $profile = $this->getProfile();
-        $expected = $this->getExpectedCommands();
-        $commands = $this->getCommands($profile);
-
-        $this->assertSame($expected, $commands);
-    }
-
-    /**
-     * @group disconnected
-     */
-    public function testToString()
-    {
-        $this->assertEquals($this->getExpectedVersion(), $this->getProfile());
-    }
-
-    /**
-     * @group disconnected
-     */
-    public function testSupportCommand()
-    {
-        $profile = $this->getProfile();
-
-        $this->assertTrue($profile->supportsCommand('info'));
-        $this->assertTrue($profile->supportsCommand('INFO'));
-
-        $this->assertFalse($profile->supportsCommand('unknown'));
-        $this->assertFalse($profile->supportsCommand('UNKNOWN'));
-    }
-
-    /**
-     * @group disconnected
-     */
-    public function testSupportCommands()
-    {
-        $profile = $this->getProfile();
-
-        $this->assertTrue($profile->supportsCommands(array('get', 'set')));
-        $this->assertTrue($profile->supportsCommands(array('GET', 'SET')));
-
-        $this->assertFalse($profile->supportsCommands(array('get', 'unknown')));
-
-        $this->assertFalse($profile->supportsCommands(array('unknown1', 'unknown2')));
-    }
-
-    /**
-     * @group disconnected
-     */
-    public function testGetCommandClass()
-    {
-        $profile = $this->getProfile();
-
-        $this->assertSame('Predis\Command\Redis\ConnectionPing', $profile->getCommandClass('ping'));
-        $this->assertSame('Predis\Command\Redis\ConnectionPing', $profile->getCommandClass('PING'));
-
-        $this->assertNull($profile->getCommandClass('unknown'));
-        $this->assertNull($profile->getCommandClass('UNKNOWN'));
-    }
-
-    /**
-     * @group disconnected
-     */
-    public function testDefineCommand()
-    {
-        $profile = $this->getProfile();
-        $command = $this->getMock('Predis\Command\CommandInterface');
-
-        $profile->defineCommand('mock', get_class($command));
-
-        $this->assertTrue($profile->supportsCommand('mock'));
-        $this->assertTrue($profile->supportsCommand('MOCK'));
-
-        $this->assertSame(get_class($command), $profile->getCommandClass('mock'));
-    }
-
-    /**
-     * @group disconnected
-     * @expectedException \InvalidArgumentException
-     * @expectedExceptionMessage The class 'stdClass' is not a valid command class.
-     */
-    public function testDefineInvalidCommand()
-    {
-        $profile = $this->getProfile();
-
-        $profile->defineCommand('mock', 'stdClass');
-    }
-
-    /**
-     * @group disconnected
-     */
-    public function testCreateCommandWithoutArguments()
-    {
-        $profile = $this->getProfile();
-
-        $command = $profile->createCommand('info');
-        $this->assertInstanceOf('Predis\Command\CommandInterface', $command);
-        $this->assertEquals('INFO', $command->getId());
-        $this->assertEquals(array(), $command->getArguments());
-    }
-
-    /**
-     * @group disconnected
-     */
-    public function testCreateCommandWithArguments()
-    {
-        $profile = $this->getProfile();
-        $arguments = array('foo', 'bar');
-
-        $command = $profile->createCommand('set', $arguments);
-        $this->assertInstanceOf('Predis\Command\CommandInterface', $command);
-        $this->assertEquals('SET', $command->getId());
-        $this->assertEquals($arguments, $command->getArguments());
-    }
-
-    /**
-     * @group disconnected
-     * @expectedException \Predis\ClientException
-     * @expectedExceptionMessage Command 'UNKNOWN' is not a registered Redis command.
-     */
-    public function testCreateUndefinedCommand()
-    {
-        $profile = $this->getProfile();
-        $profile->createCommand('unknown');
-    }
-
-    /**
-     * @group disconnected
-     */
-    public function testGetDefaultProcessor()
-    {
-        $profile = $this->getProfile();
-
-        $this->assertNull($profile->getProcessor());
-    }
-
-    /**
-     * @group disconnected
-     */
-    public function testSetProcessor()
-    {
-        $processor = $this->getMock('Predis\Command\Processor\ProcessorInterface');
-
-        $profile = $this->getProfile();
-        $profile->setProcessor($processor);
-
-        $this->assertSame($processor, $profile->getProcessor());
-    }
-
-    /**
-     * @group disconnected
-     */
-    public function testSetAndUnsetProcessor()
-    {
-        $processor = $this->getMock('Predis\Command\Processor\ProcessorInterface');
-        $profile = $this->getProfile();
-
-        $profile->setProcessor($processor);
-        $this->assertSame($processor, $profile->getProcessor());
-
-        $profile->setProcessor(null);
-        $this->assertNull($profile->getProcessor());
-    }
-
-    /**
-     * @group disconnected
-     */
-    public function testSingleProcessor()
-    {
-        // Could it be that objects passed to the return callback of a mocked
-        // method are cloned instead of being passed by reference?
-        $argsRef = null;
-
-        $processor = $this->getMock('Predis\Command\Processor\ProcessorInterface');
-        $processor->expects($this->once())
-                  ->method('process')
-                  ->with($this->isInstanceOf('Predis\Command\CommandInterface'))
-                  ->will($this->returnCallback(function (CommandInterface $cmd) use (&$argsRef) {
-                        $cmd->setRawArguments($argsRef = array_map('strtoupper', $cmd->getArguments()));
-                    }));
-
-        $profile = $this->getProfile();
-        $profile->setProcessor($processor);
-        $profile->createCommand('set', array('foo', 'bar'));
-
-        $this->assertSame(array('FOO', 'BAR'), $argsRef);
-    }
-
-    /**
-     * @group disconnected
-     */
-    public function testChainOfProcessors()
-    {
-        $processor = $this->getMock('Predis\Command\Processor\ProcessorInterface');
-        $processor->expects($this->exactly(2))
-                  ->method('process');
-
-        $chain = new ProcessorChain();
-        $chain->add($processor);
-        $chain->add($processor);
-
-        $profile = $this->getProfile();
-        $profile->setProcessor($chain);
-        $profile->createCommand('info');
-    }
-}

+ 6 - 23
tests/PHPUnit/PredisTestCase.php

@@ -12,7 +12,6 @@
 use Predis\Client;
 use Predis\Command;
 use Predis\Connection;
-use Predis\Profile;
 
 /**
  * Base test case class for the Predis test suite.
@@ -112,7 +111,7 @@ abstract class PredisTestCase extends \PHPUnit_Framework_TestCase
     protected function getDefaultOptionsArray()
     {
         return array(
-            'profile' => REDIS_SERVER_VERSION,
+            'commands' => new Command\RedisFactory(),
         );
     }
 
@@ -145,29 +144,13 @@ abstract class PredisTestCase extends \PHPUnit_Framework_TestCase
     }
 
     /**
-     * Returns a new instance of server profile.
+     * Returns a new instance of command factory.
      *
-     * @param string $version Redis profile.
-     *
-     * @return Profile\ProfileInterface
+     * @return Command\FactoryInterface
      */
-    protected function getProfile($version = null)
+    protected function getCommandFactory()
     {
-        return Profile\Factory::get($version ?: REDIS_SERVER_VERSION);
-    }
-
-    /**
-     * Returns the current server profile in use by the test suite.
-     *
-     * @return Profile\ProfileInterface
-     */
-    protected function getCurrentProfile()
-    {
-        static $profile;
-
-        $profile = $this->getProfile();
-
-        return $profile;
+        return new Command\RedisFactory();
     }
 
     /**
@@ -188,7 +171,7 @@ abstract class PredisTestCase extends \PHPUnit_Framework_TestCase
 
         $options = array_merge(
             array(
-                'profile' => $this->getProfile(),
+                'commands' => $this->getCommandFactory(),
             ),
             $options ?: array()
         );

+ 28 - 29
tests/Predis/ClientTest.php

@@ -33,7 +33,7 @@ class ClientTest extends PredisTestCase
         $this->assertSame($parameters->port, 6379);
 
         $options = $client->getOptions();
-        $this->assertSame($options->profile->getVersion(), Profile\Factory::getDefault()->getVersion());
+        $this->assertSame($options->commands, $client->getCommandFactory());
 
         $this->assertFalse($client->isConnected());
     }
@@ -53,7 +53,7 @@ class ClientTest extends PredisTestCase
         $this->assertSame($parameters->port, 6379);
 
         $options = $client->getOptions();
-        $this->assertSame($options->profile->getVersion(), Profile\Factory::getDefault()->getVersion());
+        $this->assertSame($options->commands, $client->getCommandFactory());
 
         $this->assertFalse($client->isConnected());
     }
@@ -73,7 +73,7 @@ class ClientTest extends PredisTestCase
         $this->assertSame($parameters->port, 6379);
 
         $options = $client->getOptions();
-        $this->assertSame($options->profile->getVersion(), Profile\Factory::getDefault()->getVersion());
+        $this->assertSame($options->commands, $client->getCommandFactory());
 
         $this->assertFalse($client->isConnected());
     }
@@ -233,15 +233,14 @@ class ClientTest extends PredisTestCase
      */
     public function testConstructorWithNullAndArrayArgument()
     {
-        $factory = $this->getMock('Predis\Connection\FactoryInterface');
+        $connections = $this->getMock('Predis\Connection\FactoryInterface');
 
-        $arg2 = array('profile' => '2.0', 'prefix' => 'prefix:', 'connections' => $factory);
+        $arg2 = array('prefix' => 'prefix:', 'connections' => $connections);
         $client = new Client(null, $arg2);
 
-        $profile = $client->getProfile();
-        $this->assertSame($profile->getVersion(), Profile\Factory::get('2.0')->getVersion());
-        $this->assertInstanceOf('Predis\Command\Processor\KeyPrefixProcessor', $profile->getProcessor());
-        $this->assertSame('prefix:', $profile->getProcessor()->getPrefix());
+        $this->assertInstanceOf('Predis\Command\FactoryInterface', $commands = $client->getCommandFactory());
+        $this->assertInstanceOf('Predis\Command\Processor\KeyPrefixProcessor', $commands->getProcessor());
+        $this->assertSame('prefix:', $commands->getProcessor()->getPrefix());
     }
 
     /**
@@ -351,17 +350,17 @@ class ClientTest extends PredisTestCase
     /**
      * @group disconnected
      */
-    public function testCreatesNewCommandUsingSpecifiedProfile()
+    public function testCreatesNewCommandUsingSpecifiedCommandFactory()
     {
-        $ping = Profile\Factory::getDefault()->createCommand('ping', array());
+        $ping = $this->getCommandFactory()->createCommand('ping', array());
 
-        $profile = $this->getMock('Predis\Profile\ProfileInterface');
-        $profile->expects($this->once())
-                ->method('createCommand')
-                ->with('ping', array())
-                ->will($this->returnValue($ping));
+        $commands = $this->getMock('Predis\Command\FactoryInterface');
+        $commands->expects($this->once())
+                 ->method('createCommand')
+                 ->with('ping', array())
+                 ->will($this->returnValue($ping));
 
-        $client = new Client(null, array('profile' => $profile));
+        $client = new Client(null, array('commands' => $commands));
         $this->assertSame($ping, $client->createCommand('ping', array()));
     }
 
@@ -370,10 +369,10 @@ class ClientTest extends PredisTestCase
      */
     public function testExecuteCommandReturnsParsedResponses()
     {
-        $profile = Profile\Factory::getDefault();
+        $commands = $this->getCommandFactory();
 
-        $ping = $profile->createCommand('ping', array());
-        $hgetall = $profile->createCommand('hgetall', array('metavars', 'foo', 'hoge'));
+        $ping = $commands->createCommand('ping', array());
+        $hgetall = $commands->createCommand('hgetall', array('metavars', 'foo', 'hoge'));
 
         $connection = $this->getMock('Predis\Connection\ConnectionInterface');
         $connection->expects($this->at(0))
@@ -398,7 +397,7 @@ class ClientTest extends PredisTestCase
      */
     public function testExecuteCommandThrowsExceptionOnRedisError()
     {
-        $ping = Profile\Factory::getDefault()->createCommand('ping', array());
+        $ping = $this->getCommandFactory()->createCommand('ping', array());
         $expectedResponse = new Response\Error('ERR Operation against a key holding the wrong kind of value');
 
         $connection = $this->getMock('Predis\Connection\ConnectionInterface');
@@ -415,7 +414,7 @@ class ClientTest extends PredisTestCase
      */
     public function testExecuteCommandReturnsErrorResponseOnRedisError()
     {
-        $ping = Profile\Factory::getDefault()->createCommand('ping', array());
+        $ping = $this->getCommandFactory()->createCommand('ping', array());
         $expectedResponse = new Response\Error('ERR Operation against a key holding the wrong kind of value');
 
         $connection = $this->getMock('Predis\Connection\ConnectionInterface');
@@ -434,7 +433,7 @@ class ClientTest extends PredisTestCase
      */
     public function testCallingRedisCommandExecutesInstanceOfCommand()
     {
-        $ping = Profile\Factory::getDefault()->createCommand('ping', array());
+        $ping = $this->getCommandFactory()->createCommand('ping', array());
 
         $connection = $this->getMock('Predis\Connection\ConnectionInterface');
         $connection->expects($this->once())
@@ -442,13 +441,13 @@ class ClientTest extends PredisTestCase
                    ->with($this->isInstanceOf('Predis\Command\Redis\ConnectionPing'))
                    ->will($this->returnValue('PONG'));
 
-        $profile = $this->getMock('Predis\Profile\ProfileInterface');
-        $profile->expects($this->once())
-                ->method('createCommand')
-                ->with('ping', array())
-                ->will($this->returnValue($ping));
+        $commands = $this->getMock('Predis\Command\FactoryInterface');
+        $commands->expects($this->once())
+                 ->method('createCommand')
+                 ->with('ping', array())
+                 ->will($this->returnValue($ping));
 
-        $options = array('profile' => $profile);
+        $options = array('commands' => $commands);
         $client = $this->getMock('Predis\Client', null, array($connection, $options));
 
         $this->assertEquals('PONG', $client->ping());

+ 29 - 32
tests/Predis/Cluster/PredisStrategyTest.php

@@ -11,7 +11,6 @@
 
 namespace Predis\Cluster;
 
-use Predis\Profile;
 use PredisTestCase;
 
 /**
@@ -57,7 +56,7 @@ class PredisStrategyTest extends PredisTestCase
     public function testReturnsNullOnUnsupportedCommand()
     {
         $strategy = $this->getClusterStrategy();
-        $command = Profile\Factory::getDevelopment()->createCommand('ping');
+        $command = $this->getCommandFactory()->createCommand('ping');
 
         $this->assertNull($strategy->getSlot($command));
     }
@@ -68,11 +67,11 @@ class PredisStrategyTest extends PredisTestCase
     public function testFirstKeyCommands()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
         $arguments = array('key');
 
         foreach ($this->getExpectedCommands('keys-first') as $commandID) {
-            $command = $profile->createCommand($commandID, $arguments);
+            $command = $commands->createCommand($commandID, $arguments);
             $this->assertNotNull($strategy->getSlot($command), $commandID);
         }
     }
@@ -83,11 +82,11 @@ class PredisStrategyTest extends PredisTestCase
     public function testAllKeysCommands()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
         $arguments = array('{key}:1', '{key}:2', '{key}:3', '{key}:4');
 
         foreach ($this->getExpectedCommands('keys-all') as $commandID) {
-            $command = $profile->createCommand($commandID, $arguments);
+            $command = $commands->createCommand($commandID, $arguments);
             $this->assertNotNull($strategy->getSlot($command), $commandID);
         }
     }
@@ -98,11 +97,11 @@ class PredisStrategyTest extends PredisTestCase
     public function testInterleavedKeysCommands()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
         $arguments = array('{key}:1', 'value1', '{key}:2', 'value2');
 
         foreach ($this->getExpectedCommands('keys-interleaved') as $commandID) {
-            $command = $profile->createCommand($commandID, $arguments);
+            $command = $commands->createCommand($commandID, $arguments);
             $this->assertNotNull($strategy->getSlot($command), $commandID);
         }
     }
@@ -113,15 +112,15 @@ class PredisStrategyTest extends PredisTestCase
     public function testKeysForSortCommand()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
         $arguments = array('{key}:1', 'value1', '{key}:2', 'value2');
 
         $commandID = 'SORT';
 
-        $command = $profile->createCommand($commandID, array('{key}:1'));
+        $command = $commands->createCommand($commandID, array('{key}:1'));
         $this->assertNotNull($strategy->getSlot($command), $commandID);
 
-        $command = $profile->createCommand($commandID, array('{key}:1', array('STORE' => '{key}:2')));
+        $command = $commands->createCommand($commandID, array('{key}:1', array('STORE' => '{key}:2')));
         $this->assertNotNull($strategy->getSlot($command), $commandID);
     }
 
@@ -131,11 +130,11 @@ class PredisStrategyTest extends PredisTestCase
     public function testKeysForBlockingListCommands()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
         $arguments = array('{key}:1', '{key}:2', 10);
 
         foreach ($this->getExpectedCommands('keys-blockinglist') as $commandID) {
-            $command = $profile->createCommand($commandID, $arguments);
+            $command = $commands->createCommand($commandID, $arguments);
             $this->assertNotNull($strategy->getSlot($command), $commandID);
         }
     }
@@ -146,11 +145,11 @@ class PredisStrategyTest extends PredisTestCase
     public function testKeysForZsetAggregationCommands()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
         $arguments = array('{key}:destination', 2, '{key}:1', '{key}:1', array('aggregate' => 'SUM'));
 
         foreach ($this->getExpectedCommands('keys-zaggregated') as $commandID) {
-            $command = $profile->createCommand($commandID, $arguments);
+            $command = $commands->createCommand($commandID, $arguments);
             $this->assertNotNull($strategy->getSlot($command), $commandID);
         }
     }
@@ -161,11 +160,11 @@ class PredisStrategyTest extends PredisTestCase
     public function testKeysForBitOpCommand()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
         $arguments = array('AND', '{key}:destination', '{key}:src:1', '{key}:src:2');
 
         foreach ($this->getExpectedCommands('keys-bitop') as $commandID) {
-            $command = $profile->createCommand($commandID, $arguments);
+            $command = $commands->createCommand($commandID, $arguments);
             $this->assertNotNull($strategy->getSlot($command), $commandID);
         }
     }
@@ -176,14 +175,13 @@ class PredisStrategyTest extends PredisTestCase
     public function testKeysForGeoradiusCommand()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
-
+        $commands = $this->getCommandFactory();
         $commandID = 'GEORADIUS';
 
-        $command = $profile->createCommand($commandID, array('{key}:1', 10, 10, 1, 'km'));
+        $command = $commands->createCommand($commandID, array('{key}:1', 10, 10, 1, 'km'));
         $this->assertNotNull($strategy->getSlot($command), $commandID);
 
-        $command = $profile->createCommand($commandID, array('{key}:1', 10, 10, 1, 'km', 'store', '{key}:2', 'storedist', '{key}:3'));
+        $command = $commands->createCommand($commandID, array('{key}:1', 10, 10, 1, 'km', 'store', '{key}:2', 'storedist', '{key}:3'));
         $this->assertNotNull($strategy->getSlot($command), $commandID);
     }
 
@@ -193,14 +191,13 @@ class PredisStrategyTest extends PredisTestCase
     public function testKeysForGeoradiusByMemberCommand()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
-
+        $commands = $this->getCommandFactory();
         $commandID = 'GEORADIUSBYMEMBER';
 
-        $command = $profile->createCommand($commandID, array('{key}:1', 'member', 1, 'km'));
+        $command = $commands->createCommand($commandID, array('{key}:1', 'member', 1, 'km'));
         $this->assertNotNull($strategy->getSlot($command), $commandID);
 
-        $command = $profile->createCommand($commandID, array('{key}:1', 'member', 1, 'km', 'store', '{key}:2', 'storedist', '{key}:3'));
+        $command = $commands->createCommand($commandID, array('{key}:1', 'member', 1, 'km', 'store', '{key}:2', 'storedist', '{key}:3'));
         $this->assertNotNull($strategy->getSlot($command), $commandID);
     }
 
@@ -210,11 +207,11 @@ class PredisStrategyTest extends PredisTestCase
     public function testKeysForEvalCommand()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
         $arguments = array('%SCRIPT%', 2, '{key}:1', '{key}:2', 'value1', 'value2');
 
         foreach ($this->getExpectedCommands('keys-script') as $commandID) {
-            $command = $profile->createCommand($commandID, $arguments);
+            $command = $commands->createCommand($commandID, $arguments);
             $this->assertNotNull($strategy->getSlot($command), $commandID);
         }
     }
@@ -245,15 +242,15 @@ class PredisStrategyTest extends PredisTestCase
     public function testUnsettingCommandHandler()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
 
         $strategy->setCommandHandler('set');
         $strategy->setCommandHandler('get', null);
 
-        $command = $profile->createCommand('set', array('key', 'value'));
+        $command = $commands->createCommand('set', array('key', 'value'));
         $this->assertNull($strategy->getSlot($command));
 
-        $command = $profile->createCommand('get', array('key'));
+        $command = $commands->createCommand('get', array('key'));
         $this->assertNull($strategy->getSlot($command));
     }
 
@@ -263,7 +260,7 @@ class PredisStrategyTest extends PredisTestCase
     public function testSettingCustomCommandHandler()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
 
         $callable = $this->getMock('stdClass', array('__invoke'));
         $callable->expects($this->once())
@@ -273,7 +270,7 @@ class PredisStrategyTest extends PredisTestCase
 
         $strategy->setCommandHandler('get', $callable);
 
-        $command = $profile->createCommand('get', array('key'));
+        $command = $commands->createCommand('get', array('key'));
         $this->assertNotNull($strategy->getSlot($command));
     }
 

+ 31 - 32
tests/Predis/Cluster/RedisStrategyTest.php

@@ -11,7 +11,6 @@
 
 namespace Predis\Cluster;
 
-use Predis\Profile;
 use PredisTestCase;
 
 /**
@@ -55,7 +54,7 @@ class RedisStrategyTest extends PredisTestCase
     public function testReturnsNullOnUnsupportedCommand()
     {
         $strategy = $this->getClusterStrategy();
-        $command = Profile\Factory::getDevelopment()->createCommand('ping');
+        $command = $this->getCommandFactory()->createCommand('ping');
 
         $this->assertNull($strategy->getSlot($command));
     }
@@ -66,11 +65,11 @@ class RedisStrategyTest extends PredisTestCase
     public function testFirstKeyCommands()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
         $arguments = array('key');
 
         foreach ($this->getExpectedCommands('keys-first') as $commandID) {
-            $command = $profile->createCommand($commandID, $arguments);
+            $command = $commands->createCommand($commandID, $arguments);
             $this->assertNotNull($strategy->getSlot($command), $commandID);
         }
     }
@@ -81,11 +80,11 @@ class RedisStrategyTest extends PredisTestCase
     public function testAllKeysCommandsWithOneKey()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
         $arguments = array('key');
 
         foreach ($this->getExpectedCommands('keys-all') as $commandID) {
-            $command = $profile->createCommand($commandID, $arguments);
+            $command = $commands->createCommand($commandID, $arguments);
             $this->assertNotNull($strategy->getSlot($command), $commandID);
         }
     }
@@ -96,11 +95,11 @@ class RedisStrategyTest extends PredisTestCase
     public function testAllKeysCommandsWithMoreKeys()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
         $arguments = array('key1', 'key2');
 
         foreach ($this->getExpectedCommands('keys-all') as $commandID) {
-            $command = $profile->createCommand($commandID, $arguments);
+            $command = $commands->createCommand($commandID, $arguments);
             $this->assertNull($strategy->getSlot($command), $commandID);
         }
     }
@@ -111,11 +110,11 @@ class RedisStrategyTest extends PredisTestCase
     public function testInterleavedKeysCommandsWithOneKey()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
         $arguments = array('key:1', 'value1');
 
         foreach ($this->getExpectedCommands('keys-interleaved') as $commandID) {
-            $command = $profile->createCommand($commandID, $arguments);
+            $command = $commands->createCommand($commandID, $arguments);
             $this->assertNotNull($strategy->getSlot($command), $commandID);
         }
     }
@@ -126,11 +125,11 @@ class RedisStrategyTest extends PredisTestCase
     public function testInterleavedKeysCommandsWithMoreKeys()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
         $arguments = array('key:1', 'value1', 'key:2', 'value2');
 
         foreach ($this->getExpectedCommands('keys-interleaved') as $commandID) {
-            $command = $profile->createCommand($commandID, $arguments);
+            $command = $commands->createCommand($commandID, $arguments);
             $this->assertNull($strategy->getSlot($command), $commandID);
         }
     }
@@ -141,15 +140,15 @@ class RedisStrategyTest extends PredisTestCase
     public function testKeysForSortCommand()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
         $arguments = array('{key}:1', 'value1', '{key}:2', 'value2');
 
         $commandID = 'SORT';
 
-        $command = $profile->createCommand($commandID, array('{key}:1'));
+        $command = $commands->createCommand($commandID, array('{key}:1'));
         $this->assertNotNull($strategy->getSlot($command), $commandID);
 
-        $command = $profile->createCommand($commandID, array('{key}:1', array('STORE' => '{key}:2')));
+        $command = $commands->createCommand($commandID, array('{key}:1', array('STORE' => '{key}:2')));
         $this->assertNotNull($strategy->getSlot($command), $commandID);
     }
 
@@ -159,11 +158,11 @@ class RedisStrategyTest extends PredisTestCase
     public function testKeysForBlockingListCommandsWithOneKey()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
         $arguments = array('key:1', 10);
 
         foreach ($this->getExpectedCommands('keys-blockinglist') as $commandID) {
-            $command = $profile->createCommand($commandID, $arguments);
+            $command = $commands->createCommand($commandID, $arguments);
             $this->assertNotNull($strategy->getSlot($command), $commandID);
         }
     }
@@ -174,11 +173,11 @@ class RedisStrategyTest extends PredisTestCase
     public function testKeysForBlockingListCommandsWithMoreKeys()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
         $arguments = array('key:1', 'key:2', 10);
 
         foreach ($this->getExpectedCommands('keys-blockinglist') as $commandID) {
-            $command = $profile->createCommand($commandID, $arguments);
+            $command = $commands->createCommand($commandID, $arguments);
             $this->assertNull($strategy->getSlot($command), $commandID);
         }
     }
@@ -189,14 +188,14 @@ class RedisStrategyTest extends PredisTestCase
     public function testKeysForGeoradiusCommand()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
 
         $commandID = 'GEORADIUS';
 
-        $command = $profile->createCommand($commandID, array('{key}:1', 10, 10, 1, 'km'));
+        $command = $commands->createCommand($commandID, array('{key}:1', 10, 10, 1, 'km'));
         $this->assertNotNull($strategy->getSlot($command), $commandID);
 
-        $command = $profile->createCommand($commandID, array('{key}:1', 10, 10, 1, 'km', 'store', '{key}:2', 'storedist', '{key}:3'));
+        $command = $commands->createCommand($commandID, array('{key}:1', 10, 10, 1, 'km', 'store', '{key}:2', 'storedist', '{key}:3'));
         $this->assertNotNull($strategy->getSlot($command), $commandID);
     }
 
@@ -206,14 +205,14 @@ class RedisStrategyTest extends PredisTestCase
     public function testKeysForGeoradiusByMemberCommand()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
 
         $commandID = 'GEORADIUSBYMEMBER';
 
-        $command = $profile->createCommand($commandID, array('{key}:1', 'member', 1, 'km'));
+        $command = $commands->createCommand($commandID, array('{key}:1', 'member', 1, 'km'));
         $this->assertNotNull($strategy->getSlot($command), $commandID);
 
-        $command = $profile->createCommand($commandID, array('{key}:1', 'member', 1, 'km', 'store', '{key}:2', 'storedist', '{key}:3'));
+        $command = $commands->createCommand($commandID, array('{key}:1', 'member', 1, 'km', 'store', '{key}:2', 'storedist', '{key}:3'));
         $this->assertNotNull($strategy->getSlot($command), $commandID);
     }
 
@@ -223,11 +222,11 @@ class RedisStrategyTest extends PredisTestCase
     public function testKeysForEvalCommand()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
         $arguments = array('%SCRIPT%', 1, 'key:1', 'value1');
 
         foreach ($this->getExpectedCommands('keys-script') as $commandID) {
-            $command = $profile->createCommand($commandID, $arguments);
+            $command = $commands->createCommand($commandID, $arguments);
             $this->assertNotNull($strategy->getSlot($command), $commandID);
         }
     }
@@ -258,15 +257,15 @@ class RedisStrategyTest extends PredisTestCase
     public function testUnsettingCommandHandler()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
 
         $strategy->setCommandHandler('set');
         $strategy->setCommandHandler('get', null);
 
-        $command = $profile->createCommand('set', array('key', 'value'));
+        $command = $commands->createCommand('set', array('key', 'value'));
         $this->assertNull($strategy->getSlot($command));
 
-        $command = $profile->createCommand('get', array('key'));
+        $command = $commands->createCommand('get', array('key'));
         $this->assertNull($strategy->getSlot($command));
     }
 
@@ -276,7 +275,7 @@ class RedisStrategyTest extends PredisTestCase
     public function testSettingCustomCommandHandler()
     {
         $strategy = $this->getClusterStrategy();
-        $profile = Profile\Factory::getDevelopment();
+        $commands = $this->getCommandFactory();
 
         $callable = $this->getMock('stdClass', array('__invoke'));
         $callable->expects($this->once())
@@ -286,7 +285,7 @@ class RedisStrategyTest extends PredisTestCase
 
         $strategy->setCommandHandler('get', $callable);
 
-        $command = $profile->createCommand('get', array('key'));
+        $command = $commands->createCommand('get', array('key'));
         $this->assertNotNull($strategy->getSlot($command));
     }
 

+ 48 - 45
tests/Predis/Collection/Iterator/HashKeyTest.php

@@ -11,7 +11,6 @@
 
 namespace Predis\Collection\Iterator;
 
-use Predis\Profile;
 use PredisTestCase;
 
 /**
@@ -22,15 +21,19 @@ class HashKeyTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException \Predis\NotSupportedException
-     * @expectedExceptionMessage The current profile does not support 'HSCAN'.
+     * @expectedExceptionMessage 'HSCAN' is not supported by the current command factory.
      */
-    public function testThrowsExceptionOnInvalidProfile()
+    public function testThrowsExceptionOnMissingCommand()
     {
-        $client = $this->getMock('Predis\ClientInterface');
+        $commands = $this->getMock('Predis\Command\FactoryInterface');
+        $commands->expects($this->any())
+                 ->method('supportsCommand')
+                 ->will($this->returnValue(false));
 
+        $client = $this->getMock('Predis\ClientInterface');
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.0')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($commands));
 
         new HashKey($client, 'key:hash');
     }
@@ -40,11 +43,11 @@ class HashKeyTest extends PredisTestCase
      */
     public function testIterationWithNoResults()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'hscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'hscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->once())
                ->method('hscan')
                ->with('key:hash', 0, array())
@@ -63,11 +66,11 @@ class HashKeyTest extends PredisTestCase
      */
     public function testIterationWithIntegerFields()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'hscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'hscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->once())
                ->method('hscan')
                ->with('key:hash', 0, array())
@@ -106,11 +109,11 @@ class HashKeyTest extends PredisTestCase
      */
     public function testIterationOnSingleFetch()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'hscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'hscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->once())
                ->method('hscan')
                ->with('key:hash', 0, array())
@@ -144,11 +147,11 @@ class HashKeyTest extends PredisTestCase
      */
     public function testIterationOnMultipleFetches()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'hscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'hscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('hscan')
                ->with('key:hash', 0, array())
@@ -188,11 +191,11 @@ class HashKeyTest extends PredisTestCase
      */
     public function testIterationOnMultipleFetchesAndHoleInFirstFetch()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'hscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'hscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('hscan')
                ->with('key:hash', 0, array())
@@ -225,11 +228,11 @@ class HashKeyTest extends PredisTestCase
      */
     public function testIterationOnMultipleFetchesAndHoleInMidFetch()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'hscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'hscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('hscan')
                ->with('key:hash', 0, array())
@@ -273,11 +276,11 @@ class HashKeyTest extends PredisTestCase
      */
     public function testIterationWithOptionMatch()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'hscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'hscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('hscan')
                ->with('key:hash', 0, array('MATCH' => 'field:*'))
@@ -306,11 +309,11 @@ class HashKeyTest extends PredisTestCase
      */
     public function testIterationWithOptionMatchOnMultipleFetches()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'hscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'hscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('hscan')
                ->with('key:hash', 0, array('MATCH' => 'field:*'))
@@ -345,11 +348,11 @@ class HashKeyTest extends PredisTestCase
      */
     public function testIterationWithOptionCount()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'hscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'hscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('hscan')
                ->with('key:hash', 0, array('COUNT' => 2))
@@ -378,11 +381,11 @@ class HashKeyTest extends PredisTestCase
      */
     public function testIterationWithOptionCountOnMultipleFetches()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'hscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'hscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('hscan')
                ->with('key:hash', 0, array('COUNT' => 1))
@@ -417,11 +420,11 @@ class HashKeyTest extends PredisTestCase
      */
     public function testIterationWithOptionsMatchAndCount()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'hscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'hscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('hscan')
                ->with('key:hash', 0, array('MATCH' => 'field:*', 'COUNT' => 2))
@@ -450,11 +453,11 @@ class HashKeyTest extends PredisTestCase
      */
     public function testIterationWithOptionsMatchAndCountOnMultipleFetches()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'hscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'hscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('hscan')
                ->with('key:hash', 0, array('MATCH' => 'field:*', 'COUNT' => 1))
@@ -489,11 +492,11 @@ class HashKeyTest extends PredisTestCase
      */
     public function testIterationRewindable()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'hscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'hscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->exactly(2))
                ->method('hscan')
                ->with('key:hash', 0, array())

+ 45 - 42
tests/Predis/Collection/Iterator/KeyspaceTest.php

@@ -11,7 +11,6 @@
 
 namespace Predis\Collection\Iterator;
 
-use Predis\Profile;
 use PredisTestCase;
 
 /**
@@ -22,15 +21,19 @@ class KeyspaceTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException \Predis\NotSupportedException
-     * @expectedExceptionMessage The current profile does not support 'SCAN'.
+     * @expectedExceptionMessage 'SCAN' is not supported by the current command factory.
      */
-    public function testThrowsExceptionOnInvalidProfile()
+    public function testThrowsExceptionOnMissingCommand()
     {
-        $client = $this->getMock('Predis\ClientInterface');
+        $commands = $this->getMock('Predis\Command\FactoryInterface');
+        $commands->expects($this->any())
+                 ->method('supportsCommand')
+                 ->will($this->returnValue(false));
 
+        $client = $this->getMock('Predis\ClientInterface');
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.0')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($commands));
 
         new Keyspace($client);
     }
@@ -40,11 +43,11 @@ class KeyspaceTest extends PredisTestCase
      */
     public function testIterationWithNoResults()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'scan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'scan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->once())
                ->method('scan')
                ->with(0, array())
@@ -61,11 +64,11 @@ class KeyspaceTest extends PredisTestCase
      */
     public function testIterationOnSingleFetch()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'scan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'scan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->once())
                ->method('scan')
                ->with(0, array())
@@ -97,11 +100,11 @@ class KeyspaceTest extends PredisTestCase
      */
     public function testIterationOnMultipleFetches()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'scan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'scan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('scan')
                ->with(0, array())
@@ -137,11 +140,11 @@ class KeyspaceTest extends PredisTestCase
      */
     public function testIterationOnMultipleFetchesAndHoleInFirstFetch()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'scan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'scan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('scan')
                ->with(0, array())
@@ -172,11 +175,11 @@ class KeyspaceTest extends PredisTestCase
      */
     public function testIterationOnMultipleFetchesAndHoleInMidFetch()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'scan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'scan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('scan')
                ->with(0, array())
@@ -216,11 +219,11 @@ class KeyspaceTest extends PredisTestCase
      */
     public function testIterationWithOptionMatch()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'scan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'scan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('scan')
                ->with(0, array('MATCH' => 'key:*'))
@@ -247,11 +250,11 @@ class KeyspaceTest extends PredisTestCase
      */
     public function testIterationWithOptionMatchOnMultipleFetches()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'scan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'scan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('scan')
                ->with(0, array('MATCH' => 'key:*'))
@@ -282,11 +285,11 @@ class KeyspaceTest extends PredisTestCase
      */
     public function testIterationWithOptionCount()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'scan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'scan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('scan')
                ->with(0, array('COUNT' => 2))
@@ -313,11 +316,11 @@ class KeyspaceTest extends PredisTestCase
      */
     public function testIterationWithOptionCountOnMultipleFetches()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'scan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'scan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('scan')
                ->with(0, array('COUNT' => 1))
@@ -348,11 +351,11 @@ class KeyspaceTest extends PredisTestCase
      */
     public function testIterationWithOptionsMatchAndCount()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'scan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'scan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('scan')
                ->with(0, array('MATCH' => 'key:*', 'COUNT' => 2))
@@ -379,11 +382,11 @@ class KeyspaceTest extends PredisTestCase
      */
     public function testIterationWithOptionsMatchAndCountOnMultipleFetches()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'scan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'scan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('scan')
                ->with(0, array('MATCH' => 'key:*', 'COUNT' => 1))
@@ -414,11 +417,11 @@ class KeyspaceTest extends PredisTestCase
      */
     public function testIterationRewindable()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'scan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'scan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->exactly(2))
                ->method('scan')
                ->with(0, array())

+ 42 - 23
tests/Predis/Collection/Iterator/ListKeyTest.php

@@ -11,7 +11,6 @@
 
 namespace Predis\Collection\Iterator;
 
-use Predis\Profile;
 use PredisTestCase;
 
 /**
@@ -19,16 +18,36 @@ use PredisTestCase;
  */
 class ListKeyTest extends PredisTestCase
 {
+    /**
+     * @group disconnected
+     * @expectedException \Predis\NotSupportedException
+     * @expectedExceptionMessage 'LRANGE' is not supported by the current command factory.
+     */
+    public function testThrowsExceptionOnMissingCommand()
+    {
+        $commands = $this->getMock('Predis\Command\FactoryInterface');
+        $commands->expects($this->any())
+                 ->method('supportsCommand')
+                 ->will($this->returnValue(false));
+
+        $client = $this->getMock('Predis\ClientInterface');
+        $client->expects($this->any())
+               ->method('getCommandFactory')
+               ->will($this->returnValue($commands));
+
+        new ListKey($client, 'key:list');
+    }
+
     /**
      * @group disconnected
      */
     public function testIterationWithNoResults()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'lrange'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'lrange'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::getDefault()));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->once())
                ->method('lrange')
                ->with('key:list', 0, 9)
@@ -45,11 +64,11 @@ class ListKeyTest extends PredisTestCase
      */
     public function testIterationOnSingleFetch()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'lrange'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'lrange'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::getDefault()));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->once())
                ->method('lrange')
                ->with('key:list', 0, 9)
@@ -81,11 +100,11 @@ class ListKeyTest extends PredisTestCase
      */
     public function testIterationOnMultipleFetches()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'lrange'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'lrange'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::getDefault()));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('lrange')
                ->with('key:list', 0, 9)
@@ -117,8 +136,8 @@ class ListKeyTest extends PredisTestCase
     {
         $client = $this->getMock('Predis\ClientInterface');
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::getDefault()));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
 
         new ListKey($client, 'key:list', 'wrong');
     }
@@ -132,8 +151,8 @@ class ListKeyTest extends PredisTestCase
     {
         $client = $this->getMock('Predis\ClientInterface');
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::getDefault()));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
 
         new ListKey($client, 'key:list', 'wrong');
     }
@@ -143,11 +162,11 @@ class ListKeyTest extends PredisTestCase
      */
     public function testIterationWithCountParameter()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'lrange'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'lrange'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::getDefault()));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('lrange')
                ->with('key:list', 0, 4)
@@ -174,11 +193,11 @@ class ListKeyTest extends PredisTestCase
      */
     public function testIterationWithCountParameterOnMultipleFetches()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'lrange'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'lrange'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::getDefault()));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('lrange')
                ->with('key:list', 0, 1)
@@ -214,11 +233,11 @@ class ListKeyTest extends PredisTestCase
      */
     public function testIterationRewindable()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'lrange'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'lrange'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::getDefault()));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->exactly(2))
                ->method('lrange')
                ->with('key:list', 0, 9)

+ 45 - 42
tests/Predis/Collection/Iterator/SetKeyTest.php

@@ -11,7 +11,6 @@
 
 namespace Predis\Collection\Iterator;
 
-use Predis\Profile;
 use PredisTestCase;
 
 /**
@@ -22,15 +21,19 @@ class SetKeyTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException \Predis\NotSupportedException
-     * @expectedExceptionMessage The current profile does not support 'SSCAN'.
+     * @expectedExceptionMessage 'SSCAN' is not supported by the current command factory.
      */
-    public function testThrowsExceptionOnInvalidProfile()
+    public function testThrowsExceptionOnMissingCommand()
     {
-        $client = $this->getMock('Predis\ClientInterface');
+        $commands = $this->getMock('Predis\Command\FactoryInterface');
+        $commands->expects($this->any())
+                 ->method('supportsCommand')
+                 ->will($this->returnValue(false));
 
+        $client = $this->getMock('Predis\ClientInterface');
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.0')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($commands));
 
         new SetKey($client, 'key:set');
     }
@@ -40,11 +43,11 @@ class SetKeyTest extends PredisTestCase
      */
     public function testIterationWithNoResults()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'sscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'sscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->once())
                ->method('sscan')
                ->with('key:set', 0, array())
@@ -61,11 +64,11 @@ class SetKeyTest extends PredisTestCase
      */
     public function testIterationOnSingleFetch()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'sscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'sscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->once())
                ->method('sscan')
                ->with('key:set', 0, array())
@@ -97,11 +100,11 @@ class SetKeyTest extends PredisTestCase
      */
     public function testIterationOnMultipleFetches()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'sscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'sscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('sscan')
                ->with('key:set', 0, array())
@@ -137,11 +140,11 @@ class SetKeyTest extends PredisTestCase
      */
     public function testIterationOnMultipleFetchesAndHoleInFirstFetch()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'sscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'sscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('sscan')
                ->with('key:set', 0, array())
@@ -172,11 +175,11 @@ class SetKeyTest extends PredisTestCase
      */
     public function testIterationOnMultipleFetchesAndHoleInMidFetch()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'sscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'sscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('sscan')
                ->with('key:set', 0, array())
@@ -216,11 +219,11 @@ class SetKeyTest extends PredisTestCase
      */
     public function testIterationWithOptionMatch()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'sscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'sscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('sscan')
                ->with('key:set', 0, array('MATCH' => 'member:*'))
@@ -247,11 +250,11 @@ class SetKeyTest extends PredisTestCase
      */
     public function testIterationWithOptionMatchOnMultipleFetches()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'sscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'sscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('sscan')
                ->with('key:set', 0, array('MATCH' => 'member:*'))
@@ -282,11 +285,11 @@ class SetKeyTest extends PredisTestCase
      */
     public function testIterationWithOptionCount()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'sscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'sscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('sscan')
                ->with('key:set', 0, array('COUNT' => 2))
@@ -313,11 +316,11 @@ class SetKeyTest extends PredisTestCase
      */
     public function testIterationWithOptionCountOnMultipleFetches()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'sscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'sscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('sscan')
                ->with('key:set', 0, array('COUNT' => 1))
@@ -348,11 +351,11 @@ class SetKeyTest extends PredisTestCase
      */
     public function testIterationWithOptionsMatchAndCount()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'sscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'sscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('sscan')
                ->with('key:set', 0, array('MATCH' => 'member:*', 'COUNT' => 2))
@@ -379,11 +382,11 @@ class SetKeyTest extends PredisTestCase
      */
     public function testIterationWithOptionsMatchAndCountOnMultipleFetches()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'sscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'sscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('sscan')
                ->with('key:set', 0, array('MATCH' => 'member:*', 'COUNT' => 1))
@@ -414,11 +417,11 @@ class SetKeyTest extends PredisTestCase
      */
     public function testIterationRewindable()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'sscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'sscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->exactly(2))
                ->method('sscan')
                ->with('key:set', 0, array())

+ 48 - 45
tests/Predis/Collection/Iterator/SortedSetKeyTest.php

@@ -11,7 +11,6 @@
 
 namespace Predis\Collection\Iterator;
 
-use Predis\Profile;
 use PredisTestCase;
 
 /**
@@ -22,15 +21,19 @@ class SortedSetKeyTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException \Predis\NotSupportedException
-     * @expectedExceptionMessage The current profile does not support 'ZSCAN'.
+     * @expectedExceptionMessage 'ZSCAN' is not supported by the current command factory.
      */
-    public function testThrowsExceptionOnInvalidProfile()
+    public function testThrowsExceptionOnMissingCommand()
     {
-        $client = $this->getMock('Predis\ClientInterface');
+        $commands = $this->getMock('Predis\Command\FactoryInterface');
+        $commands->expects($this->any())
+                 ->method('supportsCommand')
+                 ->will($this->returnValue(false));
 
+        $client = $this->getMock('Predis\ClientInterface');
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.0')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($commands));
 
         new SortedSetKey($client, 'key:zset');
     }
@@ -40,11 +43,11 @@ class SortedSetKeyTest extends PredisTestCase
      */
     public function testIterationWithNoResults()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'zscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'zscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->once())
                ->method('zscan')
                ->with('key:zset', 0, array())
@@ -62,11 +65,11 @@ class SortedSetKeyTest extends PredisTestCase
      */
     public function testIterationWithIntegerMembers()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'zscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'zscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->once())
                ->method('zscan')
                ->with('key:zset', 0, array())
@@ -100,11 +103,11 @@ class SortedSetKeyTest extends PredisTestCase
      */
     public function testIterationOnSingleFetch()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'zscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'zscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->once())
                ->method('zscan')
                ->with('key:zset', 0, array())
@@ -138,11 +141,11 @@ class SortedSetKeyTest extends PredisTestCase
      */
     public function testIterationOnMultipleFetches()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'zscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'zscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('zscan')
                ->with('key:zset', 0, array())
@@ -182,11 +185,11 @@ class SortedSetKeyTest extends PredisTestCase
      */
     public function testIterationOnMultipleFetchesAndHoleInFirstFetch()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'zscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'zscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('zscan')
                ->with('key:zset', 0, array())
@@ -219,11 +222,11 @@ class SortedSetKeyTest extends PredisTestCase
      */
     public function testIterationOnMultipleFetchesAndHoleInMidFetch()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'zscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'zscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('zscan')
                ->with('key:zset', 0, array())
@@ -267,11 +270,11 @@ class SortedSetKeyTest extends PredisTestCase
      */
     public function testIterationWithOptionMatch()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'zscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'zscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('zscan')
                ->with('key:zset', 0, array('MATCH' => 'member:*'))
@@ -300,11 +303,11 @@ class SortedSetKeyTest extends PredisTestCase
      */
     public function testIterationWithOptionMatchOnMultipleFetches()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'zscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'zscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('zscan')
                ->with('key:zset', 0, array('MATCH' => 'member:*'))
@@ -339,11 +342,11 @@ class SortedSetKeyTest extends PredisTestCase
      */
     public function testIterationWithOptionCount()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'zscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'zscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('zscan')
                ->with('key:zset', 0, array('COUNT' => 2))
@@ -372,11 +375,11 @@ class SortedSetKeyTest extends PredisTestCase
      */
     public function testIterationWithOptionCountOnMultipleFetches()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'zscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'zscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('zscan')
                ->with('key:zset', 0, array('COUNT' => 1))
@@ -411,11 +414,11 @@ class SortedSetKeyTest extends PredisTestCase
      */
     public function testIterationWithOptionsMatchAndCount()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'zscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'zscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('zscan')
                ->with('key:zset', 0, array('MATCH' => 'member:*', 'COUNT' => 2))
@@ -444,11 +447,11 @@ class SortedSetKeyTest extends PredisTestCase
      */
     public function testIterationWithOptionsMatchAndCountOnMultipleFetches()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'zscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'zscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->at(1))
                ->method('zscan')
                ->with('key:zset', 0, array('MATCH' => 'member:*', 'COUNT' => 1))
@@ -483,11 +486,11 @@ class SortedSetKeyTest extends PredisTestCase
      */
     public function testIterationRewindable()
     {
-        $client = $this->getMock('Predis\Client', array('getProfile', 'zscan'));
+        $client = $this->getMock('Predis\Client', array('getCommandFactory', 'zscan'));
 
         $client->expects($this->any())
-               ->method('getProfile')
-               ->will($this->returnValue(Profile\Factory::get('2.8')));
+               ->method('getCommandFactory')
+               ->will($this->returnValue($this->getCommandFactory()));
         $client->expects($this->exactly(2))
                ->method('zscan')
                ->with('key:zset', 0, array())

+ 2 - 0
tests/Predis/Command/Redis/HashDeleteTest.php

@@ -71,6 +71,7 @@ class HashDeleteTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testDeletesSpecifiedFieldsFromHash()
     {
@@ -85,6 +86,7 @@ class HashDeleteTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 2 - 0
tests/Predis/Command/Redis/HashExistsTest.php

@@ -60,6 +60,7 @@ class HashExistsTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testReturnsExistenceOfSpecifiedField()
     {
@@ -74,6 +75,7 @@ class HashExistsTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 2 - 0
tests/Predis/Command/Redis/HashGetAllTest.php

@@ -62,6 +62,7 @@ class HashGetAllTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testReturnsAllTheFieldsAndTheirValues()
     {
@@ -75,6 +76,7 @@ class HashGetAllTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 2 - 0
tests/Predis/Command/Redis/HashGetMultipleTest.php

@@ -76,6 +76,7 @@ class HashGetMultipleTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testReturnsValuesOfSpecifiedFields()
     {
@@ -91,6 +92,7 @@ class HashGetMultipleTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 2 - 0
tests/Predis/Command/Redis/HashGetTest.php

@@ -57,6 +57,7 @@ class HashGetTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testReturnsValueOfSpecifiedField()
     {
@@ -71,6 +72,7 @@ class HashGetTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 4 - 0
tests/Predis/Command/Redis/HashIncrementByFloatTest.php

@@ -57,6 +57,7 @@ class HashIncrementByFloatTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testIncrementsValueOfFieldByFloat()
     {
@@ -72,6 +73,7 @@ class HashIncrementByFloatTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testDecrementsValueOfFieldByFloat()
     {
@@ -87,6 +89,7 @@ class HashIncrementByFloatTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessageRegExp /ERR hash value is not a( valid)? float/
      */
@@ -100,6 +103,7 @@ class HashIncrementByFloatTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 4 - 0
tests/Predis/Command/Redis/HashIncrementByTest.php

@@ -57,6 +57,7 @@ class HashIncrementByTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testIncrementsValueOfFieldByInteger()
     {
@@ -70,6 +71,7 @@ class HashIncrementByTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testDecrementsValueOfFieldByInteger()
     {
@@ -83,6 +85,7 @@ class HashIncrementByTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR hash value is not an integer
      */
@@ -96,6 +99,7 @@ class HashIncrementByTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 2 - 0
tests/Predis/Command/Redis/HashKeysTest.php

@@ -62,6 +62,7 @@ class HashKeysTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testReturnsKeysOfHash()
     {
@@ -75,6 +76,7 @@ class HashKeysTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 2 - 0
tests/Predis/Command/Redis/HashLengthTest.php

@@ -57,6 +57,7 @@ class HashLengthTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testReturnsLengthOfHash()
     {
@@ -70,6 +71,7 @@ class HashLengthTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 3 - 0
tests/Predis/Command/Redis/HashScanTest.php

@@ -90,6 +90,7 @@ class HashScanTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.8.0
      */
     public function testScanWithoutMatch()
     {
@@ -108,6 +109,7 @@ class HashScanTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.8.0
      */
     public function testScanWithMatchingMembers()
     {
@@ -122,6 +124,7 @@ class HashScanTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.8.0
      */
     public function testScanWithNoMatchingMembers()
     {

+ 4 - 1
tests/Predis/Command/Redis/HashSetMultipleTest.php

@@ -71,6 +71,7 @@ class HashSetMultipleTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testSetsSpecifiedFieldsOfHash()
     {
@@ -85,8 +86,9 @@ class HashSetMultipleTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
-    public function testSetsTheSpecifiedFie()
+    public function testSetsTheSpecifiedField()
     {
         $redis = $this->getClient();
 
@@ -97,6 +99,7 @@ class HashSetMultipleTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 2 - 0
tests/Predis/Command/Redis/HashSetPreserveTest.php

@@ -60,6 +60,7 @@ class HashSetPreserveTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testSetsNewFieldsAndPreserversExistingOnes()
     {
@@ -74,6 +75,7 @@ class HashSetPreserveTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 2 - 0
tests/Predis/Command/Redis/HashSetTest.php

@@ -60,6 +60,7 @@ class HashSetTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testSetsValueOfSpecifiedField()
     {
@@ -73,6 +74,7 @@ class HashSetTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 2 - 0
tests/Predis/Command/Redis/HashValuesTest.php

@@ -62,6 +62,7 @@ class HashValuesTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testReturnsValuesOfHash()
     {
@@ -75,6 +76,7 @@ class HashValuesTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 2 - 0
tests/Predis/Command/Redis/KeyMigrateTest.php

@@ -87,6 +87,7 @@ class KeyMigrateTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testReturnsStatusNOKEYOnNonExistingKey()
     {
@@ -98,6 +99,7 @@ class KeyMigrateTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      * @group slow
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage IOERR

+ 3 - 0
tests/Predis/Command/Redis/KeyPersistTest.php

@@ -60,6 +60,7 @@ class KeyPersistTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testRemovesExpireFromKey()
     {
@@ -74,6 +75,7 @@ class KeyPersistTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testReturnsZeroOnNonExpiringKeys()
     {
@@ -86,6 +88,7 @@ class KeyPersistTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testReturnsZeroOnNonExistentKeys()
     {

+ 2 - 0
tests/Predis/Command/Redis/KeyPreciseExpireAtTest.php

@@ -61,6 +61,7 @@ class KeyPreciseExpireAtTest extends PredisCommandTestCase
     /**
      * @medium
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      * @group slow
      */
     public function testCanExpireKeys()
@@ -80,6 +81,7 @@ class KeyPreciseExpireAtTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testDeletesKeysOnPastUnixTime()
     {

+ 4 - 0
tests/Predis/Command/Redis/KeyPreciseExpireTest.php

@@ -60,6 +60,7 @@ class KeyPreciseExpireTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testReturnsZeroOnNonExistingKeys()
     {
@@ -71,6 +72,7 @@ class KeyPreciseExpireTest extends PredisCommandTestCase
     /**
      * @medium
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      * @group slow
      */
     public function testCanExpireKeys()
@@ -88,6 +90,7 @@ class KeyPreciseExpireTest extends PredisCommandTestCase
      /**
       * @medium
       * @group connected
+      * @requiresRedisVersion >= 2.6.0
       * @group slow
       */
      public function testConsistencyWithTTL()
@@ -106,6 +109,7 @@ class KeyPreciseExpireTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testDeletesKeysOnNegativeTTL()
     {

+ 3 - 0
tests/Predis/Command/Redis/KeyPreciseTimeToLiveTest.php

@@ -59,6 +59,7 @@ class KeyPreciseTimeToLiveTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testReturnsTTL()
     {
@@ -72,6 +73,7 @@ class KeyPreciseTimeToLiveTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testReturnsLessThanZeroOnNonExpiringKeys()
     {
@@ -83,6 +85,7 @@ class KeyPreciseTimeToLiveTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testReturnsLessThanZeroOnNonExistingKeys()
     {

+ 3 - 0
tests/Predis/Command/Redis/KeyScanTest.php

@@ -90,6 +90,7 @@ class KeyScanTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.8.0
      */
     public function testScanWithoutMatch()
     {
@@ -105,6 +106,7 @@ class KeyScanTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.8.0
      */
     public function testScanWithMatchingKeys()
     {
@@ -120,6 +122,7 @@ class KeyScanTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.8.0
      */
     public function testScanWithNoMatchingKeys()
     {

+ 3 - 0
tests/Predis/Command/Redis/ListLengthTest.php

@@ -57,6 +57,7 @@ class ListLengthTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testReturnsLengthOfList()
     {
@@ -71,6 +72,7 @@ class ListLengthTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testReturnsZeroLengthOnNonExistingList()
     {
@@ -81,6 +83,7 @@ class ListLengthTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 3 - 0
tests/Predis/Command/Redis/ListPushHeadXTest.php

@@ -57,6 +57,7 @@ class ListPushHeadXTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testPushesElementsToHeadOfExistingList()
     {
@@ -70,6 +71,7 @@ class ListPushHeadXTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testDoesNotPushElementOnNonExistingKey()
     {
@@ -82,6 +84,7 @@ class ListPushHeadXTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 3 - 0
tests/Predis/Command/Redis/ListPushTailXTest.php

@@ -57,6 +57,7 @@ class ListPushTailXTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testPushesElementsToHeadOfExistingList()
     {
@@ -70,6 +71,7 @@ class ListPushTailXTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testDoesNotPushElementOnNonExistingKey()
     {
@@ -82,6 +84,7 @@ class ListPushTailXTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 1 - 0
tests/Predis/Command/Redis/PubSubPublishTest.php

@@ -57,6 +57,7 @@ class PubSubPublishTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testPublishesMessagesToChannel()
     {

+ 8 - 1
tests/Predis/Command/Redis/PubSubSubscribeByPatternTest.php

@@ -76,6 +76,7 @@ class PubSubSubscribeByPatternTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testReturnsTheFirstPsubscribedChannelDetails()
     {
@@ -86,6 +87,7 @@ class PubSubSubscribeByPatternTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testCanSendPsubscribeAfterPsubscribe()
     {
@@ -97,6 +99,7 @@ class PubSubSubscribeByPatternTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testCanSendSubscribeAfterPsubscribe()
     {
@@ -108,6 +111,7 @@ class PubSubSubscribeByPatternTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testCanSendUnsubscribeAfterPsubscribe()
     {
@@ -120,6 +124,7 @@ class PubSubSubscribeByPatternTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testCanSendPunsubscribeAfterPsubscribe()
     {
@@ -132,11 +137,12 @@ class PubSubSubscribeByPatternTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testCanSendQuitAfterPsubscribe()
     {
         $redis = $this->getClient();
-        $quit = $this->getProfile()->createCommand('quit');
+        $quit = $this->getCommandFactory()->createCommand('quit');
 
         $this->assertSame(array('subscribe', 'channel1', 1), $redis->subscribe('channel1'));
         $this->assertEquals('OK', $redis->executeCommand($quit));
@@ -144,6 +150,7 @@ class PubSubSubscribeByPatternTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessageRegExp /ERR only .* allowed in this context/
      */

+ 8 - 1
tests/Predis/Command/Redis/PubSubSubscribeTest.php

@@ -76,6 +76,7 @@ class PubSubSubscribeTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testReturnsTheFirstSubscribedChannelDetails()
     {
@@ -86,6 +87,7 @@ class PubSubSubscribeTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testCanSendSubscribeAfterSubscribe()
     {
@@ -97,6 +99,7 @@ class PubSubSubscribeTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testCanSendPsubscribeAfterSubscribe()
     {
@@ -108,6 +111,7 @@ class PubSubSubscribeTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testCanSendUnsubscribeAfterSubscribe()
     {
@@ -120,6 +124,7 @@ class PubSubSubscribeTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testCanSendPunsubscribeAfterSubscribe()
     {
@@ -132,11 +137,12 @@ class PubSubSubscribeTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testCanSendQuitAfterSubscribe()
     {
         $redis = $this->getClient();
-        $quit = $this->getProfile()->createCommand('quit');
+        $quit = $this->getCommandFactory()->createCommand('quit');
 
         $this->assertSame(array('subscribe', 'channel:foo', 1), $redis->subscribe('channel:foo'));
         $this->assertEquals('OK', $redis->executeCommand($quit));
@@ -144,6 +150,7 @@ class PubSubSubscribeTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessageRegExp /ERR only .* allowed in this context/
      */

+ 4 - 0
tests/Predis/Command/Redis/PubSubUnsubscribeByPatternTest.php

@@ -76,6 +76,7 @@ class PubSubUnsubscribeByPatternTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testDoesNotSwitchToSubscribeMode()
     {
@@ -87,6 +88,7 @@ class PubSubUnsubscribeByPatternTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testUnsubscribesFromNotSubscribedChannels()
     {
@@ -97,6 +99,7 @@ class PubSubUnsubscribeByPatternTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testUnsubscribesFromSubscribedChannels()
     {
@@ -109,6 +112,7 @@ class PubSubUnsubscribeByPatternTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testUnsubscribesFromAllSubscribedChannels()
     {

+ 4 - 0
tests/Predis/Command/Redis/PubSubUnsubscribeTest.php

@@ -76,6 +76,7 @@ class PubSubUnsubscribeTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testDoesNotSwitchToSubscribeMode()
     {
@@ -87,6 +88,7 @@ class PubSubUnsubscribeTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testUnsubscribesFromNotSubscribedChannels()
     {
@@ -97,6 +99,7 @@ class PubSubUnsubscribeTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testUnsubscribesFromSubscribedChannels()
     {
@@ -108,6 +111,7 @@ class PubSubUnsubscribeTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testUnsubscribesFromAllSubscribedChannels()
     {

+ 3 - 0
tests/Predis/Command/Redis/ServerClientTest.php

@@ -124,6 +124,7 @@ BUFFER;
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.4.0
      */
     public function testReturnsListOfConnectedClients()
     {
@@ -198,6 +199,7 @@ BUFFER;
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.4.0
      * @expectedException \Predis\Response\ServerException
      */
     public function testThrowsExceptioOnWrongModifier()
@@ -209,6 +211,7 @@ BUFFER;
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.4.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR No such client
      */

+ 7 - 0
tests/Predis/Command/Redis/ServerConfigTest.php

@@ -82,6 +82,7 @@ class ServerConfigTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testReturnsListOfConfigurationValues()
     {
@@ -96,6 +97,7 @@ class ServerConfigTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testReturnsListOfOneConfigurationEntry()
     {
@@ -108,6 +110,7 @@ class ServerConfigTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testReturnsEmptyListOnUnknownConfigurationEntry()
     {
@@ -118,6 +121,7 @@ class ServerConfigTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testReturnsTrueOnSuccessfulConfiguration()
     {
@@ -134,6 +138,7 @@ class ServerConfigTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR Unsupported CONFIG parameter: foo
      */
@@ -146,6 +151,7 @@ class ServerConfigTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testReturnsTrueOnResetstat()
     {
@@ -156,6 +162,7 @@ class ServerConfigTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      */
     public function testThrowsExceptionOnUnknownSubcommand()

+ 3 - 0
tests/Predis/Command/Redis/ServerEvalSHATest.php

@@ -66,6 +66,7 @@ class ServerEvalSHATest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testExecutesSpecifiedLuaScript()
     {
@@ -81,6 +82,7 @@ class ServerEvalSHATest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      * @expectedException \Predis\Response\ServerException
      */
     public function testThrowsExceptionOnWrongNumberOfKeys()
@@ -96,6 +98,7 @@ class ServerEvalSHATest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      * @expectedException \Predis\Response\ServerException
      */
     public function testThrowsExceptionOnInvalidScript()

+ 3 - 0
tests/Predis/Command/Redis/ServerEvalTest.php

@@ -66,6 +66,7 @@ class ServerEvalTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testExecutesSpecifiedLuaScript()
     {
@@ -79,6 +80,7 @@ class ServerEvalTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      * @expectedException \Predis\Response\ServerException
      */
     public function testThrowsExceptionOnWrongNumberOfKeys()
@@ -91,6 +93,7 @@ class ServerEvalTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      * @expectedException \Predis\Response\ServerException
      */
     public function testThrowsExceptionOnInvalidScript()

+ 160 - 121
tests/Predis/Command/Redis/ServerInfoTest.php

@@ -47,7 +47,151 @@ class ServerInfoTest extends PredisCommandTestCase
     /**
      * @group disconnected
      */
-    public function testParseResponse()
+    public function testCanParseNewResponseFormat()
+    {
+        $raw = <<<BUFFER
+# Server
+redis_version:2.9.0
+redis_git_sha1:237194b7
+redis_git_dirty:0
+arch_bits:32
+multiplexing_api:epoll
+process_id:16620
+tcp_port:6379
+uptime_in_seconds:444
+uptime_in_days:0
+lru_clock:198040
+
+# Clients
+connected_clients:1
+client_longest_output_list:0
+client_biggest_input_buf:0
+blocked_clients:0
+
+# Memory
+used_memory:628076
+used_memory_human:613.36K
+used_memory_rss:1568768
+used_memory_peak:570056
+used_memory_peak_human:556.70K
+used_memory_lua:14336
+mem_fragmentation_ratio:2.50
+mem_allocator:jemalloc-2.2.1
+
+# Persistence
+loading:0
+aof_enabled:0
+changes_since_last_save:0
+bgsave_in_progress:0
+last_save_time:1323185719
+bgrewriteaof_in_progress:0
+
+# Stats
+total_connections_received:4
+total_commands_processed:3
+rejected_connections:0
+expired_keys:0
+evicted_keys:0
+keyspace_hits:0
+keyspace_misses:0
+pubsub_channels:0
+pubsub_patterns:0
+latest_fork_usec:0
+
+# Replication
+role:master
+connected_slaves:0
+
+# CPU
+used_cpu_sys:0.06
+used_cpu_user:0.06
+used_cpu_sys_children:0.00
+used_cpu_user_children:0.00
+
+# Cluster
+cluster_enabled:0
+
+# Keyspace
+db0:keys=2,expires=0
+db5:keys=1,expires=0
+
+BUFFER;
+
+        $expected = array(
+            'Server' => array(
+                'redis_version' => '2.9.0',
+                'redis_git_sha1' => '237194b7',
+                'redis_git_dirty' => '0',
+                'arch_bits' => '32',
+                'multiplexing_api' => 'epoll',
+                'process_id' => '16620',
+                'tcp_port' => '6379',
+                'uptime_in_seconds' => '444',
+                'uptime_in_days' => '0',
+                'lru_clock' => '198040',
+            ),
+            'Clients' => array(
+                'connected_clients' => '1',
+                'client_longest_output_list' => '0',
+                'client_biggest_input_buf' => '0',
+                'blocked_clients' => '0',
+            ),
+            'Memory' => array(
+                'used_memory' => '628076',
+                'used_memory_human' => '613.36K',
+                'used_memory_rss' => '1568768',
+                'used_memory_peak' => '570056',
+                'used_memory_peak_human' => '556.70K',
+                'used_memory_lua' => '14336',
+                'mem_fragmentation_ratio' => '2.50',
+                'mem_allocator' => 'jemalloc-2.2.1',
+            ),
+            'Persistence' => array(
+                'loading' => '0',
+                'aof_enabled' => '0',
+                'changes_since_last_save' => '0',
+                'bgsave_in_progress' => '0',
+                'last_save_time' => '1323185719',
+                'bgrewriteaof_in_progress' => '0',
+            ),
+            'Stats' => array(
+                'total_connections_received' => '4',
+                'total_commands_processed' => '3',
+                'rejected_connections' => '0',
+                'expired_keys' => '0',
+                'evicted_keys' => '0',
+                'keyspace_hits' => '0',
+                'keyspace_misses' => '0',
+                'pubsub_channels' => '0',
+                'pubsub_patterns' => '0',
+                'latest_fork_usec' => '0',
+            ),
+            'Replication' => array(
+                'role' => 'master',
+                'connected_slaves' => '0',
+            ),
+            'CPU' => array(
+                'used_cpu_sys' => '0.06',
+                'used_cpu_user' => '0.06',
+                'used_cpu_sys_children' => '0.00',
+                'used_cpu_user_children' => '0.00',
+            ),
+            'Cluster' => array(
+                'cluster_enabled' => '0',
+            ),
+            'Keyspace' => array(
+                'db0' => array('keys' => '2', 'expires' => '0'),
+                'db5' => array('keys' => '1', 'expires' => '0'),
+            ),
+        );
+
+        $this->assertSame($expected, $this->getCommand()->parseResponse($raw));
+    }
+
+    /**
+     * @group disconnected
+     */
+    public function testCanParseOldResponsesFormat()
     {
         $raw = <<<BUFFER
 redis_version:2.4.4
@@ -150,137 +294,32 @@ BUFFER;
     /**
      * @group disconnected
      */
-    public function testCanParseResponsesFromRedis30()
+    public function testDoesNotEmitPhpNoticeOnEmptyResponse()
     {
-        $raw = <<<BUFFER
-# Server
-redis_version:2.9.0
-redis_git_sha1:237194b7
-redis_git_dirty:0
-arch_bits:32
-multiplexing_api:epoll
-process_id:16620
-tcp_port:6379
-uptime_in_seconds:444
-uptime_in_days:0
-lru_clock:198040
-
-# Clients
-connected_clients:1
-client_longest_output_list:0
-client_biggest_input_buf:0
-blocked_clients:0
-
-# Memory
-used_memory:628076
-used_memory_human:613.36K
-used_memory_rss:1568768
-used_memory_peak:570056
-used_memory_peak_human:556.70K
-used_memory_lua:14336
-mem_fragmentation_ratio:2.50
-mem_allocator:jemalloc-2.2.1
-
-# Persistence
-loading:0
-aof_enabled:0
-changes_since_last_save:0
-bgsave_in_progress:0
-last_save_time:1323185719
-bgrewriteaof_in_progress:0
-
-# Stats
-total_connections_received:4
-total_commands_processed:3
-rejected_connections:0
-expired_keys:0
-evicted_keys:0
-keyspace_hits:0
-keyspace_misses:0
-pubsub_channels:0
-pubsub_patterns:0
-latest_fork_usec:0
-
-# Replication
-role:master
-connected_slaves:0
-
-# CPU
-used_cpu_sys:0.06
-used_cpu_user:0.06
-used_cpu_sys_children:0.00
-used_cpu_user_children:0.00
-
-# Cluster
-cluster_enabled:0
-
-# Keyspace
-db0:keys=2,expires=0
-db5:keys=1,expires=0
-
-BUFFER;
-
-        $expected = array(
-            'redis_version' => '2.9.0',
-            'redis_git_sha1' => '237194b7',
-            'redis_git_dirty' => '0',
-            'arch_bits' => '32',
-            'multiplexing_api' => 'epoll',
-            'process_id' => '16620',
-            'tcp_port' => '6379',
-            'uptime_in_seconds' => '444',
-            'uptime_in_days' => '0',
-            'lru_clock' => '198040',
-            'connected_clients' => '1',
-            'client_longest_output_list' => '0',
-            'client_biggest_input_buf' => '0',
-            'blocked_clients' => '0',
-            'used_memory' => '628076',
-            'used_memory_human' => '613.36K',
-            'used_memory_rss' => '1568768',
-            'used_memory_peak' => '570056',
-            'used_memory_peak_human' => '556.70K',
-            'used_memory_lua' => '14336',
-            'mem_fragmentation_ratio' => '2.50',
-            'mem_allocator' => 'jemalloc-2.2.1',
-            'loading' => '0',
-            'aof_enabled' => '0',
-            'changes_since_last_save' => '0',
-            'bgsave_in_progress' => '0',
-            'last_save_time' => '1323185719',
-            'bgrewriteaof_in_progress' => '0',
-            'total_connections_received' => '4',
-            'total_commands_processed' => '3',
-            'rejected_connections' => '0',
-            'expired_keys' => '0',
-            'evicted_keys' => '0',
-            'keyspace_hits' => '0',
-            'keyspace_misses' => '0',
-            'pubsub_channels' => '0',
-            'pubsub_patterns' => '0',
-            'latest_fork_usec' => '0',
-            'role' => 'master',
-            'connected_slaves' => '0',
-            'used_cpu_sys' => '0.06',
-            'used_cpu_user' => '0.06',
-            'used_cpu_sys_children' => '0.00',
-            'used_cpu_user_children' => '0.00',
-            'cluster_enabled' => '0',
-            'db0' => array('keys' => '2', 'expires' => '0'),
-            'db5' => array('keys' => '1', 'expires' => '0'),
-        );
-
-        $this->assertSame($expected, $this->getCommand()->parseResponse($raw));
+        $this->assertSame(array(), $this->getCommand()->parseResponse(''));
     }
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testReturnsAnArrayOfInfo()
     {
         $redis = $this->getClient();
         $command = $this->getCommand();
 
+        $this->assertInternalType('array', $info = $redis->executeCommand($command));
+        $this->assertArrayHasKey('redis_version', isset($info['Server']) ? $info['Server'] : $info);
+    }
+    /**
+     * @group connected
+     * @requiresRedisVersion < 2.6.0
+     */
+    public function testReturnsAnArrayOfInfoOnOlderRedisVersions()
+    {
+        $redis = $this->getClient();
+        $command = $this->getCommand();
+
         $this->assertInternalType('array', $info = $redis->executeCommand($command));
         $this->assertArrayHasKey('redis_version', $info);
     }

+ 0 - 313
tests/Predis/Command/Redis/ServerInfoV26xTest.php

@@ -1,313 +0,0 @@
-<?php
-
-/*
- * This file is part of the Predis package.
- *
- * (c) Daniele Alessandri <suppakilla@gmail.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Predis\Command\Redis;
-
-/**
- * @group commands
- * @group realm-server
- */
-class ServerInfoV26xTest extends PredisCommandTestCase
-{
-    /**
-     * {@inheritdoc}
-     */
-    protected function getExpectedCommand()
-    {
-        return 'Predis\Command\Redis\ServerInfoV26x';
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    protected function getExpectedId()
-    {
-        return 'INFO';
-    }
-
-    /**
-     * @group disconnected
-     */
-    public function testFilterArguments()
-    {
-        $command = $this->getCommand();
-        $command->setArguments(array());
-
-        $this->assertSame(array(), $command->getArguments());
-    }
-
-    /**
-     * @group disconnected
-     */
-    public function testParseResponse()
-    {
-        $raw = <<<BUFFER
-# Server
-redis_version:2.9.0
-redis_git_sha1:237194b7
-redis_git_dirty:0
-arch_bits:32
-multiplexing_api:epoll
-process_id:16620
-tcp_port:6379
-uptime_in_seconds:444
-uptime_in_days:0
-lru_clock:198040
-
-# Clients
-connected_clients:1
-client_longest_output_list:0
-client_biggest_input_buf:0
-blocked_clients:0
-
-# Memory
-used_memory:628076
-used_memory_human:613.36K
-used_memory_rss:1568768
-used_memory_peak:570056
-used_memory_peak_human:556.70K
-used_memory_lua:14336
-mem_fragmentation_ratio:2.50
-mem_allocator:jemalloc-2.2.1
-
-# Persistence
-loading:0
-aof_enabled:0
-changes_since_last_save:0
-bgsave_in_progress:0
-last_save_time:1323185719
-bgrewriteaof_in_progress:0
-
-# Stats
-total_connections_received:4
-total_commands_processed:3
-rejected_connections:0
-expired_keys:0
-evicted_keys:0
-keyspace_hits:0
-keyspace_misses:0
-pubsub_channels:0
-pubsub_patterns:0
-latest_fork_usec:0
-
-# Replication
-role:master
-connected_slaves:0
-
-# CPU
-used_cpu_sys:0.06
-used_cpu_user:0.06
-used_cpu_sys_children:0.00
-used_cpu_user_children:0.00
-
-# Cluster
-cluster_enabled:0
-
-# Keyspace
-db0:keys=2,expires=0
-db5:keys=1,expires=0
-
-BUFFER;
-
-        $expected = array(
-            'Server' => array(
-                'redis_version' => '2.9.0',
-                'redis_git_sha1' => '237194b7',
-                'redis_git_dirty' => '0',
-                'arch_bits' => '32',
-                'multiplexing_api' => 'epoll',
-                'process_id' => '16620',
-                'tcp_port' => '6379',
-                'uptime_in_seconds' => '444',
-                'uptime_in_days' => '0',
-                'lru_clock' => '198040',
-            ),
-            'Clients' => array(
-                'connected_clients' => '1',
-                'client_longest_output_list' => '0',
-                'client_biggest_input_buf' => '0',
-                'blocked_clients' => '0',
-            ),
-            'Memory' => array(
-                'used_memory' => '628076',
-                'used_memory_human' => '613.36K',
-                'used_memory_rss' => '1568768',
-                'used_memory_peak' => '570056',
-                'used_memory_peak_human' => '556.70K',
-                'used_memory_lua' => '14336',
-                'mem_fragmentation_ratio' => '2.50',
-                'mem_allocator' => 'jemalloc-2.2.1',
-            ),
-            'Persistence' => array(
-                'loading' => '0',
-                'aof_enabled' => '0',
-                'changes_since_last_save' => '0',
-                'bgsave_in_progress' => '0',
-                'last_save_time' => '1323185719',
-                'bgrewriteaof_in_progress' => '0',
-            ),
-            'Stats' => array(
-                'total_connections_received' => '4',
-                'total_commands_processed' => '3',
-                'rejected_connections' => '0',
-                'expired_keys' => '0',
-                'evicted_keys' => '0',
-                'keyspace_hits' => '0',
-                'keyspace_misses' => '0',
-                'pubsub_channels' => '0',
-                'pubsub_patterns' => '0',
-                'latest_fork_usec' => '0',
-            ),
-            'Replication' => array(
-                'role' => 'master',
-                'connected_slaves' => '0',
-            ),
-            'CPU' => array(
-                'used_cpu_sys' => '0.06',
-                'used_cpu_user' => '0.06',
-                'used_cpu_sys_children' => '0.00',
-                'used_cpu_user_children' => '0.00',
-            ),
-            'Cluster' => array(
-                'cluster_enabled' => '0',
-            ),
-            'Keyspace' => array(
-                'db0' => array('keys' => '2', 'expires' => '0'),
-                'db5' => array('keys' => '1', 'expires' => '0'),
-            ),
-        );
-
-        $this->assertSame($expected, $this->getCommand()->parseResponse($raw));
-    }
-
-    /**
-     * @group disconnected
-     */
-    public function testCanParseResponsesFromOlderRedisVersions()
-    {
-        $raw = <<<BUFFER
-redis_version:2.4.4
-redis_git_sha1:bc62bc5e
-redis_git_dirty:0
-arch_bits:32
-multiplexing_api:epoll
-process_id:15640
-uptime_in_seconds:792
-uptime_in_days:0
-lru_clock:197890
-used_cpu_sys:0.08
-used_cpu_user:0.10
-used_cpu_sys_children:0.00
-used_cpu_user_children:0.00
-connected_clients:1
-connected_slaves:0
-client_longest_output_list:0
-client_biggest_input_buf:0
-blocked_clients:0
-used_memory:556156
-used_memory_human:543.12K
-used_memory_rss:1396736
-used_memory_peak:547688
-used_memory_peak_human:534.85K
-mem_fragmentation_ratio:2.51
-mem_allocator:jemalloc-2.2.1
-loading:0
-aof_enabled:0
-changes_since_last_save:0
-bgsave_in_progress:0
-last_save_time:1323183872
-bgrewriteaof_in_progress:0
-total_connections_received:2
-total_commands_processed:1
-expired_keys:0
-evicted_keys:0
-keyspace_hits:0
-keyspace_misses:0
-pubsub_channels:0
-pubsub_patterns:0
-latest_fork_usec:0
-vm_enabled:0
-role:master
-db0:keys=2,expires=0
-db5:keys=1,expires=0
-
-BUFFER;
-
-        $expected = array(
-            'redis_version' => '2.4.4',
-            'redis_git_sha1' => 'bc62bc5e',
-            'redis_git_dirty' => '0',
-            'arch_bits' => '32',
-            'multiplexing_api' => 'epoll',
-            'process_id' => '15640',
-            'uptime_in_seconds' => '792',
-            'uptime_in_days' => '0',
-            'lru_clock' => '197890',
-            'used_cpu_sys' => '0.08',
-            'used_cpu_user' => '0.10',
-            'used_cpu_sys_children' => '0.00',
-            'used_cpu_user_children' => '0.00',
-            'connected_clients' => '1',
-            'connected_slaves' => '0',
-            'client_longest_output_list' => '0',
-            'client_biggest_input_buf' => '0',
-            'blocked_clients' => '0',
-            'used_memory' => '556156',
-            'used_memory_human' => '543.12K',
-            'used_memory_rss' => '1396736',
-            'used_memory_peak' => '547688',
-            'used_memory_peak_human' => '534.85K',
-            'mem_fragmentation_ratio' => '2.51',
-            'mem_allocator' => 'jemalloc-2.2.1',
-            'loading' => '0',
-            'aof_enabled' => '0',
-            'changes_since_last_save' => '0',
-            'bgsave_in_progress' => '0',
-            'last_save_time' => '1323183872',
-            'bgrewriteaof_in_progress' => '0',
-            'total_connections_received' => '2',
-            'total_commands_processed' => '1',
-            'expired_keys' => '0',
-            'evicted_keys' => '0',
-            'keyspace_hits' => '0',
-            'keyspace_misses' => '0',
-            'pubsub_channels' => '0',
-            'pubsub_patterns' => '0',
-            'latest_fork_usec' => '0',
-            'vm_enabled' => '0',
-            'role' => 'master',
-            'db0' => array('keys' => '2', 'expires' => '0'),
-            'db5' => array('keys' => '1', 'expires' => '0'),
-        );
-
-        $this->assertSame($expected, $this->getCommand()->parseResponse($raw));
-    }
-
-    /**
-     * @group disconnected
-     */
-    public function testDoesNotEmitPhpNoticeOnEmptyResponse()
-    {
-        $this->assertSame(array(), $this->getCommand()->parseResponse(''));
-    }
-
-    /**
-     * @group connected
-     */
-    public function testReturnsAnArrayOfInfo()
-    {
-        $redis = $this->getClient();
-        $command = $this->getCommand();
-
-        $this->assertInternalType('array', $info = $redis->executeCommand($command));
-        $this->assertArrayHasKey('redis_version', isset($info['Server']) ? $info['Server'] : $info);
-    }
-}

+ 1 - 1
tests/Predis/Command/Redis/ServerMonitorTest.php

@@ -65,7 +65,7 @@ class ServerMonitorTest extends PredisCommandTestCase
 
         // NOTE: Starting with 2.6 Redis does not return the "MONITOR" message after
         // +OK to the client that issued the MONITOR command.
-        if (version_compare($this->getProfile()->getVersion(), '2.4', '<=')) {
+        if ($this->isRedisServerVersion('<=', '2.4.0')) {
             $this->assertRegExp('/\d+.\d+(\s?\(db \d+\))? "MONITOR"/', $connection->read());
         }
     }

+ 5 - 0
tests/Predis/Command/Redis/ServerObjectTest.php

@@ -57,6 +57,7 @@ class ServerObjectTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.3
      */
     public function testObjectRefcount()
     {
@@ -68,6 +69,7 @@ class ServerObjectTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.3
      */
     public function testObjectIdletime()
     {
@@ -79,6 +81,7 @@ class ServerObjectTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.3
      */
     public function testObjectEncoding()
     {
@@ -90,6 +93,7 @@ class ServerObjectTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.3
      */
     public function testReturnsNullOnNonExistingKey()
     {
@@ -102,6 +106,7 @@ class ServerObjectTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.3
      * @expectedException \Predis\Response\ServerException
      */
     public function testThrowsExceptionOnInvalidSubcommand()

+ 4 - 0
tests/Predis/Command/Redis/ServerScriptTest.php

@@ -57,6 +57,7 @@ class ServerScriptTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testExistsReturnsAnArrayOfValues()
     {
@@ -70,6 +71,7 @@ class ServerScriptTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testLoadReturnsHashOfScripts()
     {
@@ -83,6 +85,7 @@ class ServerScriptTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testFlushesExistingScripts()
     {
@@ -96,6 +99,7 @@ class ServerScriptTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      * @expectedException \Predis\Response\ServerException
      */
     public function testThrowsExceptionOnInvalidSubcommand()

+ 3 - 0
tests/Predis/Command/Redis/ServerSlowlogTest.php

@@ -72,6 +72,7 @@ class ServerSlowlogTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.12
      */
     public function testReturnsAnArrayOfLoggedCommands()
     {
@@ -97,6 +98,7 @@ class ServerSlowlogTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.12
      */
     public function testCanResetTheLog()
     {
@@ -107,6 +109,7 @@ class ServerSlowlogTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.12
      * @expectedException \Predis\Response\ServerException
      */
     public function testThrowsExceptionOnInvalidSubcommand()

+ 1 - 0
tests/Predis/Command/Redis/ServerTimeTest.php

@@ -60,6 +60,7 @@ class ServerTimeTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testReturnsServerTime()
     {

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

@@ -81,6 +81,17 @@ class SetAddTest extends PredisCommandTestCase
         $this->assertSame(0, $redis->sadd('letters', 'b'));
     }
 
+    /**
+     * @group connected
+     * @requiresRedisVersion >= 2.4.0
+     */
+    public function testAddsMembersToSetVariadic()
+    {
+        $redis = $this->getClient();
+
+        $this->assertSame(3, $redis->sadd('letters', 'a', 'b', 'c', 'b'));
+    }
+
     /**
      * @group connected
      * @expectedException \Predis\Response\ServerException

+ 16 - 0
tests/Predis/Command/Redis/SetRemoveTest.php

@@ -85,6 +85,22 @@ class SetRemoveTest extends PredisCommandTestCase
         $this->assertSame(0, $redis->srem('digits', 1));
     }
 
+    /**
+     * @group connected
+     * @requiresRedisVersion >= 2.4.0
+     */
+    public function testRemovesMembersFromSetVariadic()
+    {
+        $redis = $this->getClient();
+
+        $redis->sadd('letters', 'a', 'b', 'c', 'd');
+
+        $this->assertSame(2, $redis->srem('letters', 'b', 'd', 'z'));
+        $this->assertSameValues(array('a', 'c'), $redis->smembers('letters'));
+
+        $this->assertSame(0, $redis->srem('digits', 1));
+    }
+
     /**
      * @group connected
      * @expectedException \Predis\Response\ServerException

+ 3 - 0
tests/Predis/Command/Redis/SetScanTest.php

@@ -90,6 +90,7 @@ class SetScanTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.8.0
      */
     public function testScanWithoutMatch()
     {
@@ -104,6 +105,7 @@ class SetScanTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.8.0
      */
     public function testScanWithMatchingMembers()
     {
@@ -117,6 +119,7 @@ class SetScanTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.8.0
      */
     public function testScanWithNoMatchingMembers()
     {

+ 3 - 0
tests/Predis/Command/Redis/StringAppendTest.php

@@ -57,6 +57,7 @@ class StringAppendTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testCreatesNewKeyOnNonExistingKey()
     {
@@ -68,6 +69,7 @@ class StringAppendTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testReturnsTheLenghtOfTheStringAfterAppend()
     {
@@ -82,6 +84,7 @@ class StringAppendTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 2 - 0
tests/Predis/Command/Redis/StringBitCountTest.php

@@ -62,6 +62,7 @@ class StringBitCountTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testReturnsNumberOfBitsSet()
     {
@@ -79,6 +80,7 @@ class StringBitCountTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 8 - 0
tests/Predis/Command/Redis/StringBitOpTest.php

@@ -76,6 +76,7 @@ class StringBitOpTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testCanPerformBitwiseAND()
     {
@@ -90,6 +91,7 @@ class StringBitOpTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testCanPerformBitwiseOR()
     {
@@ -104,6 +106,7 @@ class StringBitOpTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testCanPerformBitwiseXOR()
     {
@@ -118,6 +121,7 @@ class StringBitOpTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testCanPerformBitwiseNOT()
     {
@@ -131,6 +135,7 @@ class StringBitOpTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR BITOP NOT must be called with a single source key.
      */
@@ -141,6 +146,7 @@ class StringBitOpTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR syntax error
      */
@@ -151,6 +157,7 @@ class StringBitOpTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */
@@ -164,6 +171,7 @@ class StringBitOpTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testDoesNotThrowExceptionOnInvalidDestinationKey()
     {

+ 4 - 0
tests/Predis/Command/Redis/StringGetBitTest.php

@@ -59,6 +59,7 @@ class StringGetBitTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testCanGetBitsFromString()
     {
@@ -74,6 +75,7 @@ class StringGetBitTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR bit offset is not an integer or out of range
      */
@@ -87,6 +89,7 @@ class StringGetBitTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR bit offset is not an integer or out of range
      */
@@ -100,6 +103,7 @@ class StringGetBitTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 3 - 0
tests/Predis/Command/Redis/StringGetRangeTest.php

@@ -57,6 +57,7 @@ class StringGetRangeTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.4.0
      */
     public function testReturnsSubstring()
     {
@@ -75,6 +76,7 @@ class StringGetRangeTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.4.0
      */
     public function testReturnsEmptyStringOnNonExistingKey()
     {
@@ -85,6 +87,7 @@ class StringGetRangeTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.4.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 5 - 0
tests/Predis/Command/Redis/StringIncrementByFloatTest.php

@@ -57,6 +57,7 @@ class StringIncrementByFloatTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testCreatesNewKeyOnNonExistingKey()
     {
@@ -68,6 +69,7 @@ class StringIncrementByFloatTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testReturnsTheValueOfTheKeyAfterIncrement()
     {
@@ -84,6 +86,7 @@ class StringIncrementByFloatTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR value is not a valid float
      */
@@ -96,6 +99,7 @@ class StringIncrementByFloatTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR value is not a valid float
      */
@@ -109,6 +113,7 @@ class StringIncrementByFloatTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 5 - 0
tests/Predis/Command/Redis/StringPreciseSetExpireTest.php

@@ -57,6 +57,7 @@ class StringPreciseSetExpireTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testCreatesNewKeyAndSetsTTL()
     {
@@ -70,6 +71,7 @@ class StringPreciseSetExpireTest extends PredisCommandTestCase
     /**
      * @group connected
      * @group slow
+     * @requiresRedisVersion >= 2.6.0
      */
     public function testKeyExpiresAfterTTL()
     {
@@ -83,6 +85,7 @@ class StringPreciseSetExpireTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR value is not an integer or out of range
      */
@@ -93,6 +96,7 @@ class StringPreciseSetExpireTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR invalid expire time
      */
@@ -103,6 +107,7 @@ class StringPreciseSetExpireTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.6.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR invalid expire time
      */

+ 6 - 0
tests/Predis/Command/Redis/StringSetBitTest.php

@@ -59,6 +59,7 @@ class StringSetBitTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testCanSetBitsOfStrings()
     {
@@ -73,6 +74,7 @@ class StringSetBitTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testCreatesNewKeyOnNonExistingKey()
     {
@@ -86,6 +88,7 @@ class StringSetBitTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR bit is not an integer or out of range
      */
@@ -96,6 +99,7 @@ class StringSetBitTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR bit offset is not an integer or out of range
      */
@@ -106,6 +110,7 @@ class StringSetBitTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR bit offset is not an integer or out of range
      */
@@ -116,6 +121,7 @@ class StringSetBitTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 5 - 0
tests/Predis/Command/Redis/StringSetExpireTest.php

@@ -57,6 +57,7 @@ class StringSetExpireTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testCreatesNewKeyAndSetsTTL()
     {
@@ -71,6 +72,7 @@ class StringSetExpireTest extends PredisCommandTestCase
      * @medium
      * @group connected
      * @group slow
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testKeyExpiresAfterTTL()
     {
@@ -84,6 +86,7 @@ class StringSetExpireTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR value is not an integer or out of range
      */
@@ -94,6 +97,7 @@ class StringSetExpireTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR invalid expire time
      */
@@ -104,6 +108,7 @@ class StringSetExpireTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR invalid expire time
      */

+ 5 - 0
tests/Predis/Command/Redis/StringSetRangeTest.php

@@ -57,6 +57,7 @@ class StringSetRangeTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testCreatesNewKeyOnNonExistingKey()
     {
@@ -71,6 +72,7 @@ class StringSetRangeTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testOverwritesOrAppendBytesInKeys()
     {
@@ -87,6 +89,7 @@ class StringSetRangeTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testHandlesBinaryData()
     {
@@ -100,6 +103,7 @@ class StringSetRangeTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR offset is out of range
      */
@@ -110,6 +114,7 @@ class StringSetRangeTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 3 - 0
tests/Predis/Command/Redis/StringStrlenTest.php

@@ -57,6 +57,7 @@ class StringStrlenTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testReturnsTheLengthOfString()
     {
@@ -71,6 +72,7 @@ class StringStrlenTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testReturnsZeroOnNonExistingKeys()
     {
@@ -81,6 +83,7 @@ class StringStrlenTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

+ 2 - 0
tests/Predis/Command/Redis/TransactionDiscardTest.php

@@ -54,6 +54,7 @@ class TransactionDiscardTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testAbortsTransactionAndRestoresNormalFlow()
     {
@@ -68,6 +69,7 @@ class TransactionDiscardTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR DISCARD without MULTI
      */

+ 2 - 0
tests/Predis/Command/Redis/TransactionUnwatchTest.php

@@ -54,6 +54,7 @@ class TransactionUnwatchTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testUnwatchWatchedKeys()
     {
@@ -73,6 +74,7 @@ class TransactionUnwatchTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testCanBeCalledInsideTransaction()
     {

+ 3 - 0
tests/Predis/Command/Redis/TransactionWatchTest.php

@@ -71,6 +71,7 @@ class TransactionWatchTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testAbortsTransactionOnExternalWriteOperations()
     {
@@ -89,6 +90,7 @@ class TransactionWatchTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      */
     public function testCanWatchNotYetExistingKeys()
     {
@@ -105,6 +107,7 @@ class TransactionWatchTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.2.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage ERR WATCH inside MULTI is not allowed
      */

+ 4 - 0
tests/Predis/Command/Redis/ZSetCountTest.php

@@ -57,6 +57,7 @@ class ZSetCountTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testReturnsNumberOfElementsInGivenScoreRange()
     {
@@ -75,6 +76,7 @@ class ZSetCountTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testInfinityScoreIntervals()
     {
@@ -89,6 +91,7 @@ class ZSetCountTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      */
     public function testExclusiveScoreIntervals()
     {
@@ -103,6 +106,7 @@ class ZSetCountTest extends PredisCommandTestCase
 
     /**
      * @group connected
+     * @requiresRedisVersion >= 2.0.0
      * @expectedException \Predis\Response\ServerException
      * @expectedExceptionMessage Operation against a key holding the wrong kind of value
      */

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