diff --git a/lib/Predis/Client.php b/lib/Predis/Client.php index 74c70a86..25747f19 100644 --- a/lib/Predis/Client.php +++ b/lib/Predis/Client.php @@ -75,7 +75,7 @@ class Client implements ClientInterface return $options; } - throw new InvalidArgumentException("Invalid type for client options"); + throw new InvalidArgumentException("Invalid type for client options."); } /** @@ -134,7 +134,7 @@ class Client implements ClientInterface return $connection; } - throw new InvalidArgumentException('Invalid type for connection parameters'); + throw new InvalidArgumentException('Invalid type for connection parameters.'); } /** @@ -151,7 +151,7 @@ class Client implements ClientInterface if (!$connection instanceof ConnectionInterface) { throw new UnexpectedValueException( - 'The callable connection initializer returned an invalid type' + 'The callable connection initializer returned an invalid type.' ); } @@ -185,7 +185,7 @@ class Client implements ClientInterface public function getClientFor($connectionID) { if (!$connection = $this->getConnectionById($connectionID)) { - throw new InvalidArgumentException("Invalid connection ID: $connectionID"); + throw new InvalidArgumentException("Invalid connection ID: $connectionID."); } return new static($connection, $this->options); @@ -247,7 +247,7 @@ class Client implements ClientInterface { if (!$this->connection instanceof AggregateConnectionInterface) { throw new NotSupportedException( - 'Retrieving connections by ID is supported only when using aggregate connections' + 'Retrieving connections by ID is supported only by aggregate connections.' ); } diff --git a/lib/Predis/Cluster/Distributor/HashRing.php b/lib/Predis/Cluster/Distributor/HashRing.php index 305b9541..f0a32eb6 100644 --- a/lib/Predis/Cluster/Distributor/HashRing.php +++ b/lib/Predis/Cluster/Distributor/HashRing.php @@ -128,7 +128,7 @@ class HashRing implements DistributorInterface, HashGeneratorInterface } if (!$this->nodes) { - throw new EmptyRingException('Cannot initialize empty hashring'); + throw new EmptyRingException('Cannot initialize an empty hashring.'); } $this->ring = array(); diff --git a/lib/Predis/Cluster/PredisStrategy.php b/lib/Predis/Cluster/PredisStrategy.php index 3fa089e1..38761ef5 100644 --- a/lib/Predis/Cluster/PredisStrategy.php +++ b/lib/Predis/Cluster/PredisStrategy.php @@ -193,7 +193,7 @@ class PredisStrategy implements StrategyInterface if (!is_callable($callback)) { throw new \InvalidArgumentException( - "Callback must be a valid callable object or NULL" + "The argument must be a callable object or NULL." ); } diff --git a/lib/Predis/Cluster/RedisStrategy.php b/lib/Predis/Cluster/RedisStrategy.php index af4a5205..7a603c79 100644 --- a/lib/Predis/Cluster/RedisStrategy.php +++ b/lib/Predis/Cluster/RedisStrategy.php @@ -178,7 +178,7 @@ class RedisStrategy implements StrategyInterface if (!is_callable($callback)) { throw new \InvalidArgumentException( - "Callback must be a valid callable object or NULL" + "The argument must be a callable object or NULL." ); } diff --git a/lib/Predis/Collection/Iterator/CursorBasedIterator.php b/lib/Predis/Collection/Iterator/CursorBasedIterator.php index a192f4e0..5ec110c1 100644 --- a/lib/Predis/Collection/Iterator/CursorBasedIterator.php +++ b/lib/Predis/Collection/Iterator/CursorBasedIterator.php @@ -65,9 +65,7 @@ abstract class CursorBasedIterator implements Iterator protected function requiredCommand(ClientInterface $client, $commandID) { if (!$client->getProfile()->supportsCommand($commandID)) { - throw new NotSupportedException( - "The specified server profile does not support the `$commandID` command." - ); + throw new NotSupportedException("The current profile does not support '$commandID'."); } } diff --git a/lib/Predis/Collection/Iterator/ListKey.php b/lib/Predis/Collection/Iterator/ListKey.php index ad80eaee..aa10d8d4 100644 --- a/lib/Predis/Collection/Iterator/ListKey.php +++ b/lib/Predis/Collection/Iterator/ListKey.php @@ -51,9 +51,7 @@ class ListKey implements Iterator $this->requiredCommand($client, 'LRANGE'); if ((false === $count = filter_var($count, FILTER_VALIDATE_INT)) || $count < 0) { - throw new InvalidArgumentException( - 'The $count argument must be a positive integer.' - ); + throw new InvalidArgumentException('The $count argument must be a positive integer.'); } $this->client = $client; @@ -73,9 +71,7 @@ class ListKey implements Iterator protected function requiredCommand(ClientInterface $client, $commandID) { if (!$client->getProfile()->supportsCommand($commandID)) { - throw new NotSupportedException( - "The specified server profile does not support the `$commandID` command." - ); + throw new NotSupportedException("The current profile does not support '$commandID'."); } } diff --git a/lib/Predis/Command/Processor/ProcessorChain.php b/lib/Predis/Command/Processor/ProcessorChain.php index fb4b109b..b024b305 100644 --- a/lib/Predis/Command/Processor/ProcessorChain.php +++ b/lib/Predis/Command/Processor/ProcessorChain.php @@ -111,8 +111,8 @@ class ProcessorChain implements CommandProcessorChainInterface, \ArrayAccess { if (!$processor instanceof CommandProcessorInterface) { throw new \InvalidArgumentException( - 'A processor chain can hold only instances of classes implementing '. - 'the Predis\Command\Processor\CommandProcessorInterface interface' + "A processor chain accepts only instances of ". + "'Predis\Command\Processor\CommandProcessorInterface'." ); } diff --git a/lib/Predis/Command/RawCommand.php b/lib/Predis/Command/RawCommand.php index 37feb8a9..90ce9db4 100644 --- a/lib/Predis/Command/RawCommand.php +++ b/lib/Predis/Command/RawCommand.php @@ -32,7 +32,9 @@ class RawCommand implements CommandInterface public function __construct(array $arguments) { if (!$arguments) { - throw new InvalidArgumentException("Arguments array is missing the command ID"); + throw new InvalidArgumentException( + 'The arguments array must contain at least the command ID.' + ); } $this->commandID = strtoupper(array_shift($arguments)); diff --git a/lib/Predis/Configuration/ClusterOption.php b/lib/Predis/Configuration/ClusterOption.php index acf1fd71..87e21f0b 100644 --- a/lib/Predis/Configuration/ClusterOption.php +++ b/lib/Predis/Configuration/ClusterOption.php @@ -56,7 +56,9 @@ class ClusterOption implements OptionInterface } if (!$value instanceof ClusterConnectionInterface) { - throw new InvalidArgumentException('Instance of Predis\Connection\ClusterConnectionInterface expected'); + throw new InvalidArgumentException( + "An instance of type 'Predis\Connection\ClusterConnectionInterface' was expected." + ); } return $value; diff --git a/lib/Predis/Configuration/ConnectionFactoryOption.php b/lib/Predis/Configuration/ConnectionFactoryOption.php index 450c1530..d56ec33f 100644 --- a/lib/Predis/Configuration/ConnectionFactoryOption.php +++ b/lib/Predis/Configuration/ConnectionFactoryOption.php @@ -39,7 +39,9 @@ class ConnectionFactoryOption implements OptionInterface return $factory; } else { - throw new InvalidArgumentException('Invalid value for the connections option'); + throw new InvalidArgumentException( + 'Invalid value provided for the connections option.' + ); } } diff --git a/lib/Predis/Configuration/ProfileOption.php b/lib/Predis/Configuration/ProfileOption.php index 0e1e1a1d..5421b542 100644 --- a/lib/Predis/Configuration/ProfileOption.php +++ b/lib/Predis/Configuration/ProfileOption.php @@ -46,7 +46,7 @@ class ProfileOption implements OptionInterface $value = Factory::get($value); $this->setProcessors($options, $value); } else if (!$value instanceof ProfileInterface) { - throw new InvalidArgumentException('Invalid value for the profile option'); + throw new InvalidArgumentException('Invalid value for the profile option.'); } return $value; diff --git a/lib/Predis/Configuration/ReplicationOption.php b/lib/Predis/Configuration/ReplicationOption.php index 1bba2c76..23282936 100644 --- a/lib/Predis/Configuration/ReplicationOption.php +++ b/lib/Predis/Configuration/ReplicationOption.php @@ -48,7 +48,7 @@ class ReplicationOption implements OptionInterface } throw new InvalidArgumentException( - 'Instance of Predis\Connection\ReplicationConnectionInterface expected' + "An instance of type 'Predis\Connection\ReplicationConnectionInterface' was expected." ); } diff --git a/lib/Predis/Connection/AbstractConnection.php b/lib/Predis/Connection/AbstractConnection.php index 43269c0c..bb8cb2ee 100644 --- a/lib/Predis/Connection/AbstractConnection.php +++ b/lib/Predis/Connection/AbstractConnection.php @@ -59,11 +59,11 @@ abstract class AbstractConnection implements SingleConnectionInterface $scheme = $parameters->scheme; if ($scheme !== 'tcp' && $scheme !== 'unix') { - throw new InvalidArgumentException("Invalid scheme: $scheme"); + throw new InvalidArgumentException("Invalid scheme: '$scheme'."); } if ($scheme === 'unix' && !isset($parameters->path)) { - throw new InvalidArgumentException('Missing UNIX domain socket path'); + throw new InvalidArgumentException('Missing UNIX domain socket path.'); } return $parameters; @@ -90,7 +90,7 @@ abstract class AbstractConnection implements SingleConnectionInterface public function connect() { if ($this->isConnected()) { - throw new ClientException('Connection already estabilished'); + throw new ClientException('Connection already estabilished.'); } $this->resource = $this->createResource(); diff --git a/lib/Predis/Connection/ComposableStreamConnection.php b/lib/Predis/Connection/ComposableStreamConnection.php index 9ef32e79..626d5377 100644 --- a/lib/Predis/Connection/ComposableStreamConnection.php +++ b/lib/Predis/Connection/ComposableStreamConnection.php @@ -59,7 +59,7 @@ class ComposableStreamConnection extends StreamConnection implements ComposableC public function readBuffer($length) { if ($length <= 0) { - throw new \InvalidArgumentException('Length parameter must be greater than 0'); + throw new \InvalidArgumentException('Length parameter must be greater than 0.'); } $value = ''; @@ -69,7 +69,7 @@ class ComposableStreamConnection extends StreamConnection implements ComposableC $chunk = fread($socket, $length); if ($chunk === false || $chunk === '') { - $this->onConnectionError('Error while reading bytes from the server'); + $this->onConnectionError('Error while reading bytes from the server.'); } $value .= $chunk; @@ -90,7 +90,7 @@ class ComposableStreamConnection extends StreamConnection implements ComposableC $chunk = fgets($socket); if ($chunk === false || $chunk === '') { - $this->onConnectionError('Error while reading line from the server'); + $this->onConnectionError('Error while reading line from the server.'); } $value .= $chunk; diff --git a/lib/Predis/Connection/Factory.php b/lib/Predis/Connection/Factory.php index 3d1fa7ca..d4d7c560 100644 --- a/lib/Predis/Connection/Factory.php +++ b/lib/Predis/Connection/Factory.php @@ -46,7 +46,7 @@ class Factory implements FactoryInterface if (!$class->isSubclassOf('Predis\Connection\SingleConnectionInterface')) { throw new InvalidArgumentException( - 'A connection initializer must be a valid connection class or a callable object' + 'A connection initializer must be a valid connection class or a callable object.' ); } @@ -81,7 +81,7 @@ class Factory implements FactoryInterface $scheme = $parameters->scheme; if (!isset($this->schemes[$scheme])) { - throw new InvalidArgumentException("Unknown connection scheme: $scheme"); + throw new InvalidArgumentException("Unknown connection scheme: '$scheme'."); } $initializer = $this->schemes[$scheme]; @@ -95,8 +95,8 @@ class Factory implements FactoryInterface if (!$connection instanceof SingleConnectionInterface) { throw new InvalidArgumentException( - 'Objects returned by connection initializers must implement ' . - 'Predis\Connection\SingleConnectionInterface' + "Objects returned by connection initializers must implement ". + "'Predis\Connection\SingleConnectionInterface'." ); } diff --git a/lib/Predis/Connection/MasterSlaveReplication.php b/lib/Predis/Connection/MasterSlaveReplication.php index 0defe123..b0fa1088 100644 --- a/lib/Predis/Connection/MasterSlaveReplication.php +++ b/lib/Predis/Connection/MasterSlaveReplication.php @@ -44,9 +44,7 @@ class MasterSlaveReplication implements ReplicationConnectionInterface protected function check() { if (!isset($this->master) || !$this->slaves) { - throw new RuntimeException( - 'Replication needs a master and at least one slave.' - ); + throw new RuntimeException('Replication needs one master and at least one slave.'); } } @@ -148,7 +146,7 @@ class MasterSlaveReplication implements ReplicationConnectionInterface $connection = $this->getConnectionById($connection); } if ($connection !== $this->master && !in_array($connection, $this->slaves, true)) { - throw new InvalidArgumentException('The specified connection is not valid.'); + throw new InvalidArgumentException('Invalid connection or connection not found.'); } $this->current = $connection; diff --git a/lib/Predis/Connection/PhpiredisSocketConnection.php b/lib/Predis/Connection/PhpiredisSocketConnection.php index 3ed64b9b..28cb0bd5 100644 --- a/lib/Predis/Connection/PhpiredisSocketConnection.php +++ b/lib/Predis/Connection/PhpiredisSocketConnection.php @@ -76,13 +76,13 @@ class PhpiredisSocketConnection extends AbstractConnection { if (!extension_loaded('sockets')) { throw new NotSupportedException( - 'The "sockets" extension is required by this connection backend' + 'The "sockets" extension is required by this connection backend.' ); } if (!extension_loaded('phpiredis')) { throw new NotSupportedException( - 'The "phpiredis" extension is required by this connection backend' + 'The "phpiredis" extension is required by this connection backend.' ); } } @@ -94,7 +94,7 @@ class PhpiredisSocketConnection extends AbstractConnection { if (isset($parameters->persistent)) { throw new NotSupportedException( - "Persistent connections are not supported by this connection backend" + "Persistent connections are not supported by this connection backend." ); } @@ -239,7 +239,7 @@ class PhpiredisSocketConnection extends AbstractConnection if (ip2long($host) === false) { if (($addresses = gethostbynamel($host)) === false) { - $this->onConnectionError("Cannot resolve the address of $host"); + $this->onConnectionError("Cannot resolve the address of '$host'."); } return $addresses[array_rand($addresses)]; @@ -281,10 +281,10 @@ class PhpiredisSocketConnection extends AbstractConnection $selected = socket_select($selectable, $selectable, $null, $timeoutSecs, $timeoutUSecs); if ($selected === 2) { - $this->onConnectionError('Connection refused', SOCKET_ECONNREFUSED); + $this->onConnectionError('Connection refused.', SOCKET_ECONNREFUSED); } if ($selected === 0) { - $this->onConnectionError('Connection timed out', SOCKET_ETIMEDOUT); + $this->onConnectionError('Connection timed out.', SOCKET_ETIMEDOUT); } if ($selected === false) { $this->emitSocketError(); @@ -333,7 +333,7 @@ class PhpiredisSocketConnection extends AbstractConnection } if ($written === false) { - $this->onConnectionError('Error while writing bytes to the server'); + $this->onConnectionError('Error while writing bytes to the server.'); } $buffer = substr($buffer, $written); diff --git a/lib/Predis/Connection/PhpiredisStreamConnection.php b/lib/Predis/Connection/PhpiredisStreamConnection.php index 459f2ddf..ba1476ee 100644 --- a/lib/Predis/Connection/PhpiredisStreamConnection.php +++ b/lib/Predis/Connection/PhpiredisStreamConnection.php @@ -78,7 +78,7 @@ class PhpiredisStreamConnection extends StreamConnection { if (!extension_loaded('phpiredis')) { throw new NotSupportedException( - 'The "phpiredis" extension is required by this connection backend' + 'The "phpiredis" extension is required by this connection backend.' ); } } @@ -144,7 +144,7 @@ class PhpiredisStreamConnection extends StreamConnection $buffer = fread($socket, 4096); if ($buffer === false || $buffer === '') { - $this->onConnectionError('Error while reading bytes from the server'); + $this->onConnectionError('Error while reading bytes from the server.'); return; } diff --git a/lib/Predis/Connection/PredisCluster.php b/lib/Predis/Connection/PredisCluster.php index f910de40..43e5e522 100644 --- a/lib/Predis/Connection/PredisCluster.php +++ b/lib/Predis/Connection/PredisCluster.php @@ -135,7 +135,7 @@ class PredisCluster implements ClusterConnectionInterface, IteratorAggregate, Co if (!isset($hash)) { throw new NotSupportedException( - "Cannot use {$command->getId()} with a cluster of connections" + "Cannot use '{$command->getId()}' over clusters of connections." ); } diff --git a/lib/Predis/Connection/RedisCluster.php b/lib/Predis/Connection/RedisCluster.php index 2f7eb12b..d30aabcf 100644 --- a/lib/Predis/Connection/RedisCluster.php +++ b/lib/Predis/Connection/RedisCluster.php @@ -266,7 +266,7 @@ class RedisCluster implements ClusterConnectionInterface, IteratorAggregate, Cou if (!isset($hash)) { throw new NotSupportedException( - "Cannot use {$command->getId()} with redis-cluster" + "Cannot use '{$command->getId()}' with redis-cluster." ); } @@ -410,7 +410,7 @@ class RedisCluster implements ClusterConnectionInterface, IteratorAggregate, Cou default: throw new ProtocolException( - "Unexpected request type for a move request: $request" + "Unexpected request type for a move request: $request." ); } } diff --git a/lib/Predis/Connection/StreamConnection.php b/lib/Predis/Connection/StreamConnection.php index a5235400..da4b5928 100644 --- a/lib/Predis/Connection/StreamConnection.php +++ b/lib/Predis/Connection/StreamConnection.php @@ -167,7 +167,7 @@ class StreamConnection extends AbstractConnection } if ($written === false || $written === 0) { - $this->onConnectionError('Error while writing bytes to the server'); + $this->onConnectionError('Error while writing bytes to the server.'); } $buffer = substr($buffer, $written); @@ -183,7 +183,7 @@ class StreamConnection extends AbstractConnection $chunk = fgets($socket); if ($chunk === false || $chunk === '') { - $this->onConnectionError('Error while reading line from the server'); + $this->onConnectionError('Error while reading line from the server.'); } $prefix = $chunk[0]; @@ -207,7 +207,7 @@ class StreamConnection extends AbstractConnection $chunk = fread($socket, min($bytesLeft, 4096)); if ($chunk === false || $chunk === '') { - $this->onConnectionError('Error while reading bytes from the server'); + $this->onConnectionError('Error while reading bytes from the server.'); } $bulkData .= $chunk; @@ -238,7 +238,7 @@ class StreamConnection extends AbstractConnection return new ErrorResponse($payload); default: - $this->onProtocolError("Unknown prefix: '$prefix'"); + $this->onProtocolError("Unknown response prefix: '$prefix'."); } } diff --git a/lib/Predis/Connection/WebdisConnection.php b/lib/Predis/Connection/WebdisConnection.php index 0665f59a..effeda62 100644 --- a/lib/Predis/Connection/WebdisConnection.php +++ b/lib/Predis/Connection/WebdisConnection.php @@ -58,7 +58,7 @@ class WebdisConnection implements SingleConnectionInterface $this->assertExtensions(); if ($parameters->scheme !== 'http') { - throw new InvalidArgumentException("Invalid scheme: {$parameters->scheme}"); + throw new InvalidArgumentException("Invalid scheme: '{$parameters->scheme}'."); } $this->parameters = $parameters; @@ -82,7 +82,7 @@ class WebdisConnection implements SingleConnectionInterface private function throwNotSupportedException($function) { $class = __CLASS__; - throw new NotSupportedException("The method $class::$function() is not supported"); + throw new NotSupportedException("The method $class::$function() is not supported."); } /** @@ -92,13 +92,13 @@ class WebdisConnection implements SingleConnectionInterface { if (!extension_loaded('curl')) { throw new NotSupportedException( - 'The "curl" extension is required by this connection backend' + 'The "curl" extension is required by this connection backend.' ); } if (!extension_loaded('phpiredis')) { throw new NotSupportedException( - 'The "phpiredis" extension is required by this connection backend' + 'The "phpiredis" extension is required by this connection backend.' ); } } @@ -224,7 +224,7 @@ class WebdisConnection implements SingleConnectionInterface case 'UNWATCH': case 'DISCARD': case 'MONITOR': - throw new NotSupportedException("Disabled command: $commandID"); + throw new NotSupportedException("Command '$commandID' is not allowed by Webdis."); default: return $commandID; diff --git a/lib/Predis/Monitor/Consumer.php b/lib/Predis/Monitor/Consumer.php index bc7ca99d..a9a4d9f9 100644 --- a/lib/Predis/Monitor/Consumer.php +++ b/lib/Predis/Monitor/Consumer.php @@ -56,14 +56,12 @@ class Consumer implements Iterator { if ($client->getConnection() instanceof AggregateConnectionInterface) { throw new NotSupportedException( - 'Cannot initialize a monitor consumer when using aggregate connections' + 'Cannot initialize a monitor consumer over aggregate connections.' ); } if ($client->getProfile()->supportsCommand('monitor') === false) { - throw new NotSupportedException( - 'The current profile does not support the MONITOR command' - ); + throw new NotSupportedException("The current profile does not support 'MONITOR'."); } } diff --git a/lib/Predis/Pipeline/Atomic.php b/lib/Predis/Pipeline/Atomic.php index 8b5bfecd..e6825c33 100644 --- a/lib/Predis/Pipeline/Atomic.php +++ b/lib/Predis/Pipeline/Atomic.php @@ -34,7 +34,7 @@ class Atomic extends Pipeline { if (!$client->getProfile()->supportsCommands(array('multi', 'exec', 'discard'))) { throw new ClientException( - 'The specified server profile must support MULTI, EXEC and DISCARD.' + "The current profile does not support 'MULTI', 'EXEC' and 'DISCARD'." ); } @@ -51,9 +51,7 @@ class Atomic extends Pipeline if (!$connection instanceof SingleConnectionInterface) { $class = __CLASS__; - throw new ClientException( - "$class can be used only with connections to single nodes" - ); + throw new ClientException("The class '$class' does not support aggregate connections."); } return $connection; @@ -85,13 +83,16 @@ class Atomic extends Pipeline if (!isset($executed)) { // TODO: should be throwing a more appropriate exception. throw new ClientException( - 'The underlying transaction has been aborted by the server' + 'The underlying transaction has been aborted by the server.' ); } if (count($executed) !== count($commands)) { + $expected = count($commands); + $received = count($executed); + throw new ClientException( - "Invalid number of responses [expected: ".count($commands)." - actual: ".count($executed)."]" + "Invalid number of responses [expected $expected, received $received]." ); } diff --git a/lib/Predis/Pipeline/ConnectionErrorProof.php b/lib/Predis/Pipeline/ConnectionErrorProof.php index e37584f8..7f50470a 100644 --- a/lib/Predis/Pipeline/ConnectionErrorProof.php +++ b/lib/Predis/Pipeline/ConnectionErrorProof.php @@ -45,7 +45,9 @@ class ConnectionErrorProof extends Pipeline } else if ($connection instanceof ClusterConnectionInterface) { return $this->executeCluster($connection, $commands); } else { - throw new NotSupportedException("Unsupported connection type"); + $class = get_class($connection); + + throw new NotSupportedException("The connection class '$class' is not supported."); } } diff --git a/lib/Predis/Pipeline/Pipeline.php b/lib/Predis/Pipeline/Pipeline.php index 4aea0171..4e503bf3 100644 --- a/lib/Predis/Pipeline/Pipeline.php +++ b/lib/Predis/Pipeline/Pipeline.php @@ -172,7 +172,7 @@ class Pipeline implements BasicClientInterface, ExecutableContextInterface private function setRunning($bool) { if ($bool && $this->running) { - throw new ClientException('This pipeline is already opened'); + throw new ClientException('The current pipeline context is already being executed.'); } $this->running = $bool; @@ -187,7 +187,7 @@ class Pipeline implements BasicClientInterface, ExecutableContextInterface public function execute($callable = null) { if ($callable && !is_callable($callable)) { - throw new InvalidArgumentException('Argument passed must be a callable object'); + throw new InvalidArgumentException('The argument must be a callable object.'); } $exception = null; diff --git a/lib/Predis/Profile/Factory.php b/lib/Predis/Profile/Factory.php index 387e718a..d0e9c5bb 100644 --- a/lib/Predis/Profile/Factory.php +++ b/lib/Predis/Profile/Factory.php @@ -65,19 +65,17 @@ final class Factory * Registers a new server profile. * * @param string $alias Profile version or alias. - * @param string $profileClass FQN of a class implementing Predis\Profile\ProfileInterface. + * @param string $class FQN of a class implementing Predis\Profile\ProfileInterface. */ - public static function define($alias, $profileClass) + public static function define($alias, $class) { - $reflection = new ReflectionClass($profileClass); + $reflection = new ReflectionClass($class); if (!$reflection->isSubclassOf('Predis\Profile\ProfileInterface')) { - throw new InvalidArgumentException( - "Cannot register '$profileClass' as it is not a valid profile class" - ); + throw new InvalidArgumentException("The class '$class' is not a valid profile class."); } - self::$profiles[$alias] = $profileClass; + self::$profiles[$alias] = $class; } /** @@ -89,7 +87,7 @@ final class Factory public static function get($version) { if (!isset(self::$profiles[$version])) { - throw new ClientException("Unknown server profile: $version"); + throw new ClientException("Unknown server profile: '$version'."); } $profile = self::$profiles[$version]; diff --git a/lib/Predis/Profile/RedisProfile.php b/lib/Predis/Profile/RedisProfile.php index 62d4d494..b61cb5cf 100644 --- a/lib/Predis/Profile/RedisProfile.php +++ b/lib/Predis/Profile/RedisProfile.php @@ -86,7 +86,7 @@ abstract class RedisProfile implements ProfileInterface $commandID = strtoupper($commandID); if (!isset($this->commands[$commandID])) { - throw new ClientException("'$commandID' is not a registered Redis command"); + throw new ClientException("Command '$commandID' is not a registered Redis command."); } $commandClass = $this->commands[$commandID]; @@ -106,15 +106,15 @@ abstract class RedisProfile implements ProfileInterface * @param string $commandID Command ID. * @param string $commandClass Fully-qualified name of a Predis\Command\CommandInterface. */ - public function defineCommand($commandID, $commandClass) + public function defineCommand($commandID, $class) { - $reflection = new ReflectionClass($commandClass); + $reflection = new ReflectionClass($class); if (!$reflection->isSubclassOf('Predis\Command\CommandInterface')) { - throw new InvalidArgumentException("Cannot register '$commandClass' as it is not a valid Redis command"); + throw new InvalidArgumentException("The class '$class' is not a valid command class."); } - $this->commands[strtoupper($commandID)] = $commandClass; + $this->commands[strtoupper($commandID)] = $class; } /** diff --git a/lib/Predis/Protocol/Text/Handler/BulkResponse.php b/lib/Predis/Protocol/Text/Handler/BulkResponse.php index 17218fad..a5dbaab9 100644 --- a/lib/Predis/Protocol/Text/Handler/BulkResponse.php +++ b/lib/Predis/Protocol/Text/Handler/BulkResponse.php @@ -33,7 +33,7 @@ class BulkResponse implements ResponseHandlerInterface if ("$length" !== $payload) { CommunicationException::handle(new ProtocolException( - $connection, "Cannot parse '$payload' as the length of the bulk response" + $connection, "Cannot parse '$payload' as a valid length for a bulk response." )); } diff --git a/lib/Predis/Protocol/Text/Handler/IntegerResponse.php b/lib/Predis/Protocol/Text/Handler/IntegerResponse.php index e06e155c..78eb8047 100644 --- a/lib/Predis/Protocol/Text/Handler/IntegerResponse.php +++ b/lib/Predis/Protocol/Text/Handler/IntegerResponse.php @@ -35,7 +35,7 @@ class IntegerResponse implements ResponseHandlerInterface if ($payload !== 'nil') { CommunicationException::handle(new ProtocolException( - $connection, "Cannot parse '$payload' as a numeric response" + $connection, "Cannot parse '$payload' as a valid numeric response." )); } diff --git a/lib/Predis/Protocol/Text/Handler/MultiBulkResponse.php b/lib/Predis/Protocol/Text/Handler/MultiBulkResponse.php index 54bb1b18..e6253e60 100644 --- a/lib/Predis/Protocol/Text/Handler/MultiBulkResponse.php +++ b/lib/Predis/Protocol/Text/Handler/MultiBulkResponse.php @@ -33,7 +33,7 @@ class MultiBulkResponse implements ResponseHandlerInterface if ("$length" !== $payload) { CommunicationException::handle(new ProtocolException( - $connection, "Cannot parse '$payload' as the length of the multibulk response" + $connection, "Cannot parse '$payload' as a valid length of a multi-bulk response." )); } diff --git a/lib/Predis/Protocol/Text/Handler/StreamableMultiBulkResponse.php b/lib/Predis/Protocol/Text/Handler/StreamableMultiBulkResponse.php index f7a60f79..a2d66b7f 100644 --- a/lib/Predis/Protocol/Text/Handler/StreamableMultiBulkResponse.php +++ b/lib/Predis/Protocol/Text/Handler/StreamableMultiBulkResponse.php @@ -37,7 +37,7 @@ class StreamableMultiBulkResponse implements ResponseHandlerInterface if ("$length" != $payload) { CommunicationException::handle(new ProtocolException( - $connection, "Cannot parse '$payload' as the length of the multibulk response" + $connection, "Cannot parse '$payload' as a valid length for a multi-bulk response." )); } diff --git a/lib/Predis/Protocol/Text/ProtocolProcessor.php b/lib/Predis/Protocol/Text/ProtocolProcessor.php index 31fad388..73203a37 100644 --- a/lib/Predis/Protocol/Text/ProtocolProcessor.php +++ b/lib/Predis/Protocol/Text/ProtocolProcessor.php @@ -95,7 +95,7 @@ class ProtocolProcessor implements ProtocolProcessorInterface default: CommunicationException::handle(new ProtocolException( - $connection, "Unknown prefix: '$prefix'" + $connection, "Unknown response prefix: '$prefix'." )); } } diff --git a/lib/Predis/Protocol/Text/ResponseReader.php b/lib/Predis/Protocol/Text/ResponseReader.php index f03ddde8..939738ef 100644 --- a/lib/Predis/Protocol/Text/ResponseReader.php +++ b/lib/Predis/Protocol/Text/ResponseReader.php @@ -82,13 +82,13 @@ class ResponseReader implements ResponseReaderInterface $header = $connection->readLine(); if ($header === '') { - $this->onProtocolError($connection, 'Unexpected empty header'); + $this->onProtocolError($connection, 'Unexpected empty reponse header.'); } $prefix = $header[0]; if (!isset($this->handlers[$prefix])) { - $this->onProtocolError($connection, "Unknown prefix: '$prefix'"); + $this->onProtocolError($connection, "Unknown response prefix: '$prefix'."); } $handler = $this->handlers[$prefix]; diff --git a/lib/Predis/PubSub/Consumer.php b/lib/Predis/PubSub/Consumer.php index 0593f9b5..2651114a 100644 --- a/lib/Predis/PubSub/Consumer.php +++ b/lib/Predis/PubSub/Consumer.php @@ -61,7 +61,7 @@ class Consumer extends AbstractConsumer { if ($client->getConnection() instanceof AggregateConnectionInterface) { throw new NotSupportedException( - 'Cannot initialize a PUB/SUB consumer when using aggregate connections' + 'Cannot initialize a PUB/SUB consumer over aggregate connections.' ); } @@ -69,7 +69,7 @@ class Consumer extends AbstractConsumer if ($client->getProfile()->supportsCommands($commands) === false) { throw new NotSupportedException( - 'The current profile does not support PUB/SUB related commands' + 'The current profile does not support PUB/SUB related commands.' ); } } @@ -137,7 +137,7 @@ class Consumer extends AbstractConsumer default: throw new ClientException( - "Received an unknown message type {$response[0]} inside PUB/SUB" + "Unknown message type '{$response[0]}' received in the PUB/SUB context." ); } } diff --git a/lib/Predis/PubSub/DispatcherLoop.php b/lib/Predis/PubSub/DispatcherLoop.php index 5218b924..763ee22c 100644 --- a/lib/Predis/PubSub/DispatcherLoop.php +++ b/lib/Predis/PubSub/DispatcherLoop.php @@ -45,7 +45,7 @@ class DispatcherLoop protected function assertCallback($callable) { if (!is_callable($callable)) { - throw new InvalidArgumentException("A valid callable object must be provided"); + throw new InvalidArgumentException('The given argument must be a callable object.'); } } diff --git a/lib/Predis/Replication/ReplicationStrategy.php b/lib/Predis/Replication/ReplicationStrategy.php index a37fc1ac..6c47d4d2 100644 --- a/lib/Predis/Replication/ReplicationStrategy.php +++ b/lib/Predis/Replication/ReplicationStrategy.php @@ -46,7 +46,7 @@ class ReplicationStrategy { if (isset($this->disallowed[$id = $command->getId()])) { throw new NotSupportedException( - "The command $id is not allowed in replication mode" + "The command '$id' is not allowed in replication mode." ); } diff --git a/lib/Predis/Response/Iterator/MultiBulkTuple.php b/lib/Predis/Response/Iterator/MultiBulkTuple.php index c8a3f945..715773a0 100644 --- a/lib/Predis/Response/Iterator/MultiBulkTuple.php +++ b/lib/Predis/Response/Iterator/MultiBulkTuple.php @@ -50,14 +50,12 @@ class MultiBulkTuple extends MultiBulk implements OuterIterator { if ($iterator->getPosition() !== 0) { throw new RuntimeException( - 'Cannot initialize a tuple iterator with an already initiated iterator' + 'Cannot initialize a tuple iterator using an already initiated iterator.' ); } if (($size = count($iterator)) % 2 !== 0) { - throw new UnexpectedValueException( - "Invalid response size for a tuple iterator [$size]" - ); + throw new UnexpectedValueException("Invalid response size for a tuple iterator."); } } diff --git a/lib/Predis/Transaction/MultiExec.php b/lib/Predis/Transaction/MultiExec.php index 1cdb7090..ac15d42a 100644 --- a/lib/Predis/Transaction/MultiExec.php +++ b/lib/Predis/Transaction/MultiExec.php @@ -69,13 +69,13 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface { if ($client->getConnection() instanceof AggregateConnectionInterface) { throw new NotSupportedException( - 'Cannot initialize a MULTI/EXEC transaction when using aggregate connections' + 'Cannot initialize a MULTI/EXEC transaction over aggregate connections.' ); } if (!$client->getProfile()->supportsCommands(array('multi', 'exec', 'discard'))) { throw new NotSupportedException( - 'The current profile does not support MULTI, EXEC and DISCARD' + 'The current profile does not support MULTI, EXEC and DISCARD.' ); } } @@ -198,7 +198,7 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface } if ($response != 'QUEUED' && !$response instanceof StatusResponse) { - $this->onProtocolError('The server did not respond with a QUEUED status response'); + $this->onProtocolError('The server did not return a +QUEUED status response.'); } $this->commands->enqueue($command); @@ -215,11 +215,11 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface public function watch($keys) { if (!$this->client->getProfile()->supportsCommand('WATCH')) { - throw new NotSupportedException('WATCH is not supported by the current profile'); + throw new NotSupportedException('WATCH is not supported by the current profile.'); } if ($this->state->isWatchAllowed()) { - throw new ClientException('WATCH after MULTI is not allowed'); + throw new ClientException('Sending WATCH after MULTI is not allowed.'); } $response = $this->call('watch', array($keys)); @@ -254,7 +254,7 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface public function unwatch() { if (!$this->client->getProfile()->supportsCommand('WATCH')) { - throw new NotSupportedException('UNWATCH is not supported by the current profile'); + throw new NotSupportedException('UNWATCH is not supported by the current profile.'); } $this->state->unflag(MultiExecState::WATCH); @@ -300,27 +300,27 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface { if ($this->state->isExecuting()) { throw new ClientException( - 'Cannot invoke "execute" or "exec" inside an active transaction context' + 'Cannot invoke "execute" or "exec" inside an active transaction context.' ); } if ($callable) { if (!is_callable($callable)) { - throw new InvalidArgumentException('Argument passed must be a callable object'); + throw new InvalidArgumentException('The argument must be a callable object.'); } if (!$this->commands->isEmpty()) { $this->discard(); throw new ClientException( - 'Cannot execute a transaction block after using fluent interface - '); + 'Cannot execute a transaction block after using fluent interface.' + ); } } else if ($this->attempts) { $this->discard(); throw new InvalidArgumentException( - 'Automatic retries can be used only when a callable block is provided' + 'Automatic retries are supported only when a callable block is provided.' ); } } @@ -356,7 +356,7 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface if ($execResponse === null) { if ($attempts === 0) { throw new AbortedMultiExecException( - $this, 'The current transaction has been aborted by the server' + $this, 'The current transaction has been aborted by the server.' ); } @@ -373,7 +373,7 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface $size = count($execResponse); if ($size !== count($commands)) { - $this->onProtocolError('EXEC returned an unexpected number of response items'); + $this->onProtocolError('EXEC returned an unexpected number of response items.'); } for ($i = 0; $i < $size; $i++) { diff --git a/tests/PHPUnit/PredisConnectionTestCase.php b/tests/PHPUnit/PredisConnectionTestCase.php index 432c6830..85efcae0 100644 --- a/tests/PHPUnit/PredisConnectionTestCase.php +++ b/tests/PHPUnit/PredisConnectionTestCase.php @@ -50,7 +50,7 @@ abstract class PredisConnectionTestCase extends PredisTestCase /** * @group connected * @expectedException Predis\ClientException - * @expectedExceptionMessage Connection already estabilished + * @expectedExceptionMessage Connection already estabilished. */ public function testThrowsExceptionOnConnectWhenAlreadyConnected() { diff --git a/tests/PHPUnit/PredisProfileTestCase.php b/tests/PHPUnit/PredisProfileTestCase.php index 2f83dc61..85da06b2 100644 --- a/tests/PHPUnit/PredisProfileTestCase.php +++ b/tests/PHPUnit/PredisProfileTestCase.php @@ -149,7 +149,7 @@ abstract class PredisProfileTestCase extends PredisTestCase /** * @group disconnected * @expectedException InvalidArgumentException - * @expectedExceptionMessage Cannot register 'stdClass' as it is not a valid Redis command + * @expectedExceptionMessage The class 'stdClass' is not a valid command class. */ public function testDefineInvalidCommand() { @@ -188,7 +188,7 @@ abstract class PredisProfileTestCase extends PredisTestCase /** * @group disconnected * @expectedException Predis\ClientException - * @expectedExceptionMessage 'UNKNOWN' is not a registered Redis command + * @expectedExceptionMessage Command 'UNKNOWN' is not a registered Redis command. */ public function testCreateUndefinedCommand() { diff --git a/tests/Predis/ClientTest.php b/tests/Predis/ClientTest.php index 265e055d..9643709e 100644 --- a/tests/Predis/ClientTest.php +++ b/tests/Predis/ClientTest.php @@ -216,7 +216,7 @@ class ClientTest extends PredisTestCase /** * @group disconnected * @expectedException UnexpectedValueException - * @expectedExceptionMessage The callable connection initializer returned an invalid type + * @expectedExceptionMessage The callable connection initializer returned an invalid type. */ public function testConstructorWithCallableConnectionInitializerThrowsExceptionOnInvalidReturnType() { @@ -296,7 +296,7 @@ class ClientTest extends PredisTestCase /** * @group disconnected * @expectedException UnexpectedValueException - * @expectedExceptionMessage The callable connection initializer returned an invalid type + * @expectedExceptionMessage The callable connection initializer returned an invalid type. */ public function testConstructorWithArrayAndOptionAggregateThrowsExceptionOnInvalidReturnType() { @@ -568,7 +568,7 @@ class ClientTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\ClientException - * @expectedExceptionMessage 'INVALIDCOMMAND' is not a registered Redis command + * @expectedExceptionMessage Command 'INVALIDCOMMAND' is not a registered Redis command. */ public function testThrowsExceptionOnNonRegisteredRedisCommand() { @@ -594,7 +594,7 @@ class ClientTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage Retrieving connections by ID is supported only when using aggregate connections + * @expectedExceptionMessage Retrieving connections by ID is supported only by aggregate connections. */ public function testGetConnectionByIdWorksOnlyWithAggregateConnections() { diff --git a/tests/Predis/Cluster/Distributor/EmptyRingExceptionTest.php b/tests/Predis/Cluster/Distributor/EmptyRingExceptionTest.php index 2f04970a..ab10df50 100644 --- a/tests/Predis/Cluster/Distributor/EmptyRingExceptionTest.php +++ b/tests/Predis/Cluster/Distributor/EmptyRingExceptionTest.php @@ -20,12 +20,10 @@ class EmptyRingExceptionTest extends PredisTestCase { /** * @group disconnected + * @expectedException Predis\Cluster\Distributor\EmptyRingException */ public function testExceptionMessage() { - $message = 'Empty Ring'; - $this->setExpectedException('Predis\Cluster\Distributor\EmptyRingException', $message); - - throw new EmptyRingException($message); + throw new EmptyRingException('Empty Ring'); } } diff --git a/tests/Predis/Collection/Iterator/HashKeyTest.php b/tests/Predis/Collection/Iterator/HashKeyTest.php index 9e73f32e..da138fb4 100644 --- a/tests/Predis/Collection/Iterator/HashKeyTest.php +++ b/tests/Predis/Collection/Iterator/HashKeyTest.php @@ -23,7 +23,7 @@ class HashKeyTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage The specified server profile does not support the `HSCAN` command. + * @expectedExceptionMessage The current profile does not support 'HSCAN'. */ public function testThrowsExceptionOnInvalidProfile() { diff --git a/tests/Predis/Collection/Iterator/KeyspaceTest.php b/tests/Predis/Collection/Iterator/KeyspaceTest.php index c5c1a5cf..338f32dd 100644 --- a/tests/Predis/Collection/Iterator/KeyspaceTest.php +++ b/tests/Predis/Collection/Iterator/KeyspaceTest.php @@ -23,7 +23,7 @@ class KeyspaceTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage The specified server profile does not support the `SCAN` command. + * @expectedExceptionMessage The current profile does not support 'SCAN'. */ public function testThrowsExceptionOnInvalidProfile() { diff --git a/tests/Predis/Collection/Iterator/SetKeyTest.php b/tests/Predis/Collection/Iterator/SetKeyTest.php index cfe9915f..0c6beffd 100644 --- a/tests/Predis/Collection/Iterator/SetKeyTest.php +++ b/tests/Predis/Collection/Iterator/SetKeyTest.php @@ -23,7 +23,7 @@ class SetKeyTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage The specified server profile does not support the `SSCAN` command. + * @expectedExceptionMessage The current profile does not support 'SSCAN'. */ public function testThrowsExceptionOnInvalidProfile() { diff --git a/tests/Predis/Collection/Iterator/SortedSetKeyTest.php b/tests/Predis/Collection/Iterator/SortedSetKeyTest.php index 94719b88..0ab27081 100644 --- a/tests/Predis/Collection/Iterator/SortedSetKeyTest.php +++ b/tests/Predis/Collection/Iterator/SortedSetKeyTest.php @@ -23,7 +23,7 @@ class SortedSetTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage The specified server profile does not support the `ZSCAN` command. + * @expectedExceptionMessage The current profile does not support 'ZSCAN'. */ public function testThrowsExceptionOnInvalidProfile() { diff --git a/tests/Predis/Command/RawCommandTest.php b/tests/Predis/Command/RawCommandTest.php index 9a758dc4..7ebf5eb0 100644 --- a/tests/Predis/Command/RawCommandTest.php +++ b/tests/Predis/Command/RawCommandTest.php @@ -61,7 +61,7 @@ class RawCommandTest extends PredisTestCase /** * @group disconnected * @expectedException InvalidArgumentException - * @expectedExceptionMessage Arguments array is missing the command ID + * @expectedExceptionMessage The arguments array must contain at least the command ID. */ public function testExceptionOnMissingCommandID() { diff --git a/tests/Predis/Connection/ComposableStreamConnectionTest.php b/tests/Predis/Connection/ComposableStreamConnectionTest.php index 71862d5f..dea1426f 100644 --- a/tests/Predis/Connection/ComposableStreamConnectionTest.php +++ b/tests/Predis/Connection/ComposableStreamConnectionTest.php @@ -40,7 +40,7 @@ class ComposableStreamConnectionTest extends PredisConnectionTestCase /** * @group disconnected * @expectedException InvalidArgumentException - * @expectedExceptionMessage Invalid scheme: udp + * @expectedExceptionMessage Invalid scheme: 'udp'. */ public function testThrowsExceptionOnInvalidScheme() { @@ -83,7 +83,7 @@ class ComposableStreamConnectionTest extends PredisConnectionTestCase /** * @group connected * @expectedException Predis\Protocol\ProtocolException - * @expectedExceptionMessage Unknown prefix: 'P' + * @expectedExceptionMessage Unknown response prefix: 'P'. */ public function testThrowsExceptionOnProtocolDesynchronizationErrors() { diff --git a/tests/Predis/Connection/FactoryTest.php b/tests/Predis/Connection/FactoryTest.php index fdf9dd95..3748796f 100644 --- a/tests/Predis/Connection/FactoryTest.php +++ b/tests/Predis/Connection/FactoryTest.php @@ -155,14 +155,13 @@ class FactoryTest extends PredisTestCase /** * @group disconnected + * @expectedException InvalidArgumentException + * @expecteExceptionMessage Unknown connection scheme: 'unknown'. */ public function testCreateUndefinedConnection() { - $scheme = 'unknown'; - $this->setExpectedException('InvalidArgumentException', "Unknown connection scheme: $scheme"); - $factory = new Factory(); - $factory->create(new Parameters(array('scheme' => $scheme))); + $factory->create(new Parameters(array('scheme' => 'unknown'))); } /** @@ -212,22 +211,21 @@ class FactoryTest extends PredisTestCase /** * @group disconnected + * @expectedException InvalidArgumentException */ public function testDefineConnectionWithInvalidArgument() { - $this->setExpectedException('InvalidArgumentException'); - $factory = new Factory(); $factory->define('foobar', new \stdClass()); } /** * @group disconnected + * @expectedException InvalidArgumentException + * @expecteExceptionMessage Unknown connection scheme: 'tcp'. */ public function testUndefineDefinedConnection() { - $this->setExpectedException('InvalidArgumentException', 'Unknown connection scheme: tcp'); - $factory = new Factory(); $factory->undefine('tcp'); $factory->create('tcp://127.0.0.1'); @@ -247,6 +245,8 @@ class FactoryTest extends PredisTestCase /** * @group disconnected + * @expectedException InvalidArgumentException + * @expecteExceptionMessage Unknown connection scheme: 'redis'. */ public function testDefineAndUndefineConnection() { @@ -258,7 +258,6 @@ class FactoryTest extends PredisTestCase $this->assertInstanceOf($connectionClass, $factory->create('redis://127.0.0.1')); $factory->undefine('redis'); - $this->setExpectedException('InvalidArgumentException', 'Unknown connection scheme: redis'); $factory->create('redis://127.0.0.1'); } diff --git a/tests/Predis/Connection/MasterSlaveReplicationTest.php b/tests/Predis/Connection/MasterSlaveReplicationTest.php index 774d0ecc..201f2d58 100644 --- a/tests/Predis/Connection/MasterSlaveReplicationTest.php +++ b/tests/Predis/Connection/MasterSlaveReplicationTest.php @@ -65,7 +65,7 @@ class MasterSlaveReplicationTest extends PredisTestCase /** * @group disconnected * @expectedException RuntimeException - * @expectedExceptionMessage Replication needs a master and at least one slave + * @expectedExceptionMessage Replication needs one master and at least one slave. */ public function testThrowsExceptionOnEmptyReplication() { @@ -76,7 +76,7 @@ class MasterSlaveReplicationTest extends PredisTestCase /** * @group disconnected * @expectedException RuntimeException - * @expectedExceptionMessage Replication needs a master and at least one slave + * @expectedExceptionMessage Replication needs one master and at least one slave. */ public function testThrowsExceptionOnMissingMaster() { @@ -89,7 +89,7 @@ class MasterSlaveReplicationTest extends PredisTestCase /** * @group disconnected * @expectedException RuntimeException - * @expectedExceptionMessage Replication needs a master and at least one slave + * @expectedExceptionMessage Replication needs one master and at least one slave. */ public function testThrowsExceptionOnMissingSlave() { @@ -200,7 +200,7 @@ class MasterSlaveReplicationTest extends PredisTestCase /** * @group disconnected * @expectedException InvalidArgumentException - * @expectedExceptionMessage The specified connection is not valid + * @expectedExceptionMessage Invalid connection or connection not found. */ public function testThrowsErrorWhenSwitchingToUnknownConnection() { @@ -435,7 +435,7 @@ class MasterSlaveReplicationTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage The command INFO is not allowed in replication mode + * @expectedExceptionMessage The command 'INFO' is not allowed in replication mode. */ public function testThrowsExceptionOnNonSupportedCommand() { diff --git a/tests/Predis/Connection/PhpiredisSocketConnectionTest.php b/tests/Predis/Connection/PhpiredisSocketConnectionTest.php index cfa71713..53e3fadc 100644 --- a/tests/Predis/Connection/PhpiredisSocketConnectionTest.php +++ b/tests/Predis/Connection/PhpiredisSocketConnectionTest.php @@ -40,7 +40,7 @@ class PhpiredisSocketConnectionTest extends PredisConnectionTestCase /** * @group disconnected * @expectedException InvalidArgumentException - * @expectedExceptionMessage Invalid scheme: udp + * @expectedExceptionMessage Invalid scheme: 'udp'. */ public function testThrowsExceptionOnInvalidScheme() { diff --git a/tests/Predis/Connection/PhpiredisStreamConnectionTest.php b/tests/Predis/Connection/PhpiredisStreamConnectionTest.php index 543ee4f8..3a0d99d7 100644 --- a/tests/Predis/Connection/PhpiredisStreamConnectionTest.php +++ b/tests/Predis/Connection/PhpiredisStreamConnectionTest.php @@ -40,7 +40,7 @@ class PhpiredisStreamConnectionTest extends PredisConnectionTestCase /** * @group disconnected * @expectedException InvalidArgumentException - * @expectedExceptionMessage Invalid scheme: udp + * @expectedExceptionMessage Invalid scheme: 'udp'. */ public function testThrowsExceptionOnInvalidScheme() { diff --git a/tests/Predis/Connection/PredisClusterTest.php b/tests/Predis/Connection/PredisClusterTest.php index f6673263..2c2e5cf5 100644 --- a/tests/Predis/Connection/PredisClusterTest.php +++ b/tests/Predis/Connection/PredisClusterTest.php @@ -256,7 +256,7 @@ class PredisClusterTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage Cannot use PING with a cluster of connections + * @expectedExceptionMessage Cannot use 'PING' over clusters of connections. */ public function testThrowsExceptionOnNonShardableCommand() { diff --git a/tests/Predis/Connection/RedisClusterTest.php b/tests/Predis/Connection/RedisClusterTest.php index 655e512c..7f7de11f 100644 --- a/tests/Predis/Connection/RedisClusterTest.php +++ b/tests/Predis/Connection/RedisClusterTest.php @@ -604,7 +604,7 @@ class RedisClusterTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage Cannot use PING with redis-cluster + * @expectedExceptionMessage Cannot use 'PING' with redis-cluster. */ public function testThrowsExceptionOnNonSupportedCommand() { diff --git a/tests/Predis/Connection/StreamConnectionTest.php b/tests/Predis/Connection/StreamConnectionTest.php index 609e34ec..68bbf501 100644 --- a/tests/Predis/Connection/StreamConnectionTest.php +++ b/tests/Predis/Connection/StreamConnectionTest.php @@ -40,7 +40,7 @@ class StreamConnectionTest extends PredisConnectionTestCase /** * @group disconnected * @expectedException InvalidArgumentException - * @expectedExceptionMessage Invalid scheme: udp + * @expectedExceptionMessage Invalid scheme: 'udp'. */ public function testThrowsExceptionOnInvalidScheme() { @@ -86,7 +86,7 @@ class StreamConnectionTest extends PredisConnectionTestCase /** * @group connected * @expectedException Predis\Protocol\ProtocolException - * @expectedExceptionMessage Unknown prefix: 'P' + * @expectedExceptionMessage Unknown response prefix: 'P'. */ public function testThrowsExceptionOnProtocolDesynchronizationErrors() { diff --git a/tests/Predis/Connection/WebdisConnectionTest.php b/tests/Predis/Connection/WebdisConnectionTest.php index 295b406b..1ef9926f 100644 --- a/tests/Predis/Connection/WebdisConnectionTest.php +++ b/tests/Predis/Connection/WebdisConnectionTest.php @@ -35,7 +35,7 @@ class WebdisConnectionTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage The method Predis\Connection\WebdisConnection::writeRequest() is not supported + * @expectedExceptionMessage The method Predis\Connection\WebdisConnection::writeRequest() is not supported. */ public function testWritingCommandsIsNotSupported() { @@ -57,7 +57,7 @@ class WebdisConnectionTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage The method Predis\Connection\WebdisConnection::read() is not supported + * @expectedExceptionMessage The method Predis\Connection\WebdisConnection::read() is not supported. */ public function testReadingFromConnectionIsNotSupported() { @@ -68,7 +68,7 @@ class WebdisConnectionTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage The method Predis\Connection\WebdisConnection::addConnectCommand() is not supported + * @expectedExceptionMessage The method Predis\Connection\WebdisConnection::addConnectCommand() is not supported. * */ public function testAddingConnectCommandsIsNotSupported() @@ -80,7 +80,7 @@ class WebdisConnectionTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage Disabled command: SELECT + * @expectedExceptionMessage Command 'SELECT' is not allowed by Webdis. */ public function testRejectCommandSelect() { @@ -91,7 +91,7 @@ class WebdisConnectionTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage Disabled command: AUTH + * @expectedExceptionMessage Command 'AUTH' is not allowed by Webdis. */ public function testRejectCommandAuth() { diff --git a/tests/Predis/Monitor/ConsumerTest.php b/tests/Predis/Monitor/ConsumerTest.php index 372f4836..f5d7282e 100644 --- a/tests/Predis/Monitor/ConsumerTest.php +++ b/tests/Predis/Monitor/ConsumerTest.php @@ -24,7 +24,7 @@ class ConsumerTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage The current profile does not support the MONITOR command + * @expectedExceptionMessage The current profile does not support 'MONITOR'. */ public function testMonitorConsumerRequireMonitorCommand() { @@ -41,7 +41,7 @@ class ConsumerTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage Cannot initialize a monitor consumer when using aggregate connections + * @expectedExceptionMessage Cannot initialize a monitor consumer over aggregate connections. */ public function testMonitorConsumerDoesNotWorkOnClusters() { diff --git a/tests/Predis/Pipeline/AtomicTest.php b/tests/Predis/Pipeline/AtomicTest.php index bf135c0b..4af9d1fc 100644 --- a/tests/Predis/Pipeline/AtomicTest.php +++ b/tests/Predis/Pipeline/AtomicTest.php @@ -51,7 +51,7 @@ class AtomicTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\ClientException - * @expectedExceptionMessage The underlying transaction has been aborted by the server + * @expectedExceptionMessage The underlying transaction has been aborted by the server. */ public function testThrowsExceptionOnAbortedTransaction() { @@ -150,7 +150,7 @@ class AtomicTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\ClientException - * @expectedExceptionMessage Predis\Pipeline\Atomic can be used only with connections to single nodes + * @expectedExceptionMessage The class 'Predis\Pipeline\Atomic' does not support aggregate connections. */ public function testExecutorWithAggregateConnection() { diff --git a/tests/Predis/Profile/FactoryTest.php b/tests/Predis/Profile/FactoryTest.php index 068fd6f0..b828346a 100644 --- a/tests/Predis/Profile/FactoryTest.php +++ b/tests/Predis/Profile/FactoryTest.php @@ -65,7 +65,7 @@ class FactoryTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\ClientException - * @expectedExceptionMessage Unknown server profile: 1.0 + * @expectedExceptionMessage Unknown server profile: '1.0'. */ public function testGetUndefinedProfile() { @@ -87,7 +87,7 @@ class FactoryTest extends PredisTestCase /** * @group disconnected * @expectedException InvalidArgumentException - * @expectedExceptionMessage Cannot register 'stdClass' as it is not a valid profile class + * @expectedExceptionMessage The class 'stdClass' is not a valid profile class. */ public function testDefineInvalidProfile() { diff --git a/tests/Predis/Protocol/Text/Handler/BulkResponseTest.php b/tests/Predis/Protocol/Text/Handler/BulkResponseTest.php index 72d94d7c..1b9ac00d 100644 --- a/tests/Predis/Protocol/Text/Handler/BulkResponseTest.php +++ b/tests/Predis/Protocol/Text/Handler/BulkResponseTest.php @@ -75,7 +75,7 @@ class BulkResponseTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\Protocol\ProtocolException - * @expectedExceptionMessage Cannot parse 'invalid' as the length of the bulk response + * @expectedExceptionMessage Cannot parse 'invalid' as a valid length for a bulk response. */ public function testInvalidLength() { diff --git a/tests/Predis/Protocol/Text/Handler/IntegerResponseTest.php b/tests/Predis/Protocol/Text/Handler/IntegerResponseTest.php index a445c605..6d19f174 100644 --- a/tests/Predis/Protocol/Text/Handler/IntegerResponseTest.php +++ b/tests/Predis/Protocol/Text/Handler/IntegerResponseTest.php @@ -54,7 +54,7 @@ class IntegerResponseTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\Protocol\ProtocolException - * @expectedExceptionMessage Cannot parse 'invalid' as a numeric response + * @expectedExceptionMessage Cannot parse 'invalid' as a valid numeric response. */ public function testInvalid() { diff --git a/tests/Predis/Protocol/Text/Handler/MultiBulkResponseTest.php b/tests/Predis/Protocol/Text/Handler/MultiBulkResponseTest.php index 79bd8085..bc8d4630 100644 --- a/tests/Predis/Protocol/Text/Handler/MultiBulkResponseTest.php +++ b/tests/Predis/Protocol/Text/Handler/MultiBulkResponseTest.php @@ -68,7 +68,7 @@ class MultiBulkResponseTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\Protocol\ProtocolException - * @expectedExceptionMessage Cannot parse 'invalid' as the length of the multibulk response + * @expectedExceptionMessage Cannot parse 'invalid' as a valid length of a multi-bulk response. */ public function testInvalid() { diff --git a/tests/Predis/Protocol/Text/Handler/StreamableMultiBulkResponseTest.php b/tests/Predis/Protocol/Text/Handler/StreamableMultiBulkResponseTest.php index 64e7ee6c..edb7d149 100644 --- a/tests/Predis/Protocol/Text/Handler/StreamableMultiBulkResponseTest.php +++ b/tests/Predis/Protocol/Text/Handler/StreamableMultiBulkResponseTest.php @@ -36,7 +36,7 @@ class StreamableMultiBulkResponseTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\Protocol\ProtocolException - * @expectedExceptionMessage Cannot parse 'invalid' as the length of the multibulk response + * @expectedExceptionMessage Cannot parse 'invalid' as a valid length for a multi-bulk response. */ public function testInvalid() { diff --git a/tests/Predis/Protocol/Text/ProtocolProcessorTest.php b/tests/Predis/Protocol/Text/ProtocolProcessorTest.php index f228f53d..34ca800d 100644 --- a/tests/Predis/Protocol/Text/ProtocolProcessorTest.php +++ b/tests/Predis/Protocol/Text/ProtocolProcessorTest.php @@ -103,7 +103,7 @@ class ProtocolProcessorTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\Protocol\ProtocolException - * @expectedExceptionMessage Unknown prefix: '!' + * @expectedExceptionMessage Unknown response prefix: '!'. */ public function testUnknownResponsePrefix() { diff --git a/tests/Predis/Protocol/Text/ResponseReaderTest.php b/tests/Predis/Protocol/Text/ResponseReaderTest.php index a6ecc177..74d9b160 100644 --- a/tests/Predis/Protocol/Text/ResponseReaderTest.php +++ b/tests/Predis/Protocol/Text/ResponseReaderTest.php @@ -89,7 +89,7 @@ class ResponseReaderTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\Protocol\ProtocolException - * @expectedExceptionMessage Unexpected empty header + * @expectedExceptionMessage Unexpected empty reponse header. */ public function testEmptyResponseHeader() { @@ -106,7 +106,7 @@ class ResponseReaderTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\Protocol\ProtocolException - * @expectedExceptionMessage Unknown prefix: '!' + * @expectedExceptionMessage Unknown response prefix: '!'. */ public function testUnknownResponsePrefix() { diff --git a/tests/Predis/PubSub/ConsumerTest.php b/tests/Predis/PubSub/ConsumerTest.php index cd6afb4a..4b88dd11 100644 --- a/tests/Predis/PubSub/ConsumerTest.php +++ b/tests/Predis/PubSub/ConsumerTest.php @@ -24,7 +24,7 @@ class ConsumerTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage The current profile does not support PUB/SUB related commands + * @expectedExceptionMessage The current profile does not support PUB/SUB related commands. */ public function testPubSubConsumerRequirePubSubRelatedCommand() { @@ -40,7 +40,7 @@ class ConsumerTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage Cannot initialize a PUB/SUB consumer when using aggregate connections + * @expectedExceptionMessage Cannot initialize a PUB/SUB consumer over aggregate connections. */ public function testPubSubConsumerDoesNotWorkOnClusters() { diff --git a/tests/Predis/Replication/ReplicationStrategyTest.php b/tests/Predis/Replication/ReplicationStrategyTest.php index 45bfc03b..58ec2321 100644 --- a/tests/Predis/Replication/ReplicationStrategyTest.php +++ b/tests/Predis/Replication/ReplicationStrategyTest.php @@ -80,7 +80,7 @@ class ReplicationStrategyTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage The command INFO is not allowed in replication mode + * @expectedExceptionMessage The command 'INFO' is not allowed in replication mode. */ public function testUsingDisallowedCommandThrowsException() { diff --git a/tests/Predis/Response/Iterator/MultiBulkTupleTest.php b/tests/Predis/Response/Iterator/MultiBulkTupleTest.php index 0d34690a..68fe1530 100644 --- a/tests/Predis/Response/Iterator/MultiBulkTupleTest.php +++ b/tests/Predis/Response/Iterator/MultiBulkTupleTest.php @@ -24,7 +24,7 @@ class MultiBulkTupleTest extends PredisTestCase /** * @group disconnected * @expectedException RuntimeException - * @expectedExceptionMessage Cannot initialize a tuple iterator with an already initiated iterator + * @expectedExceptionMessage Cannot initialize a tuple iterator using an already initiated iterator. */ public function testInitiatedMultiBulkIteratorsAreNotValid() { @@ -38,7 +38,7 @@ class MultiBulkTupleTest extends PredisTestCase /** * @group disconnected * @expectedException UnexpectedValueException - * @expectedExceptionMessage Invalid response size for a tuple iterator [3] + * @expectedExceptionMessage Invalid response size for a tuple iterator. */ public function testMultiBulkWithOddSizesAreInvalid() { diff --git a/tests/Predis/Transaction/MultiExecTest.php b/tests/Predis/Transaction/MultiExecTest.php index 0fb8d7d7..9d841a33 100644 --- a/tests/Predis/Transaction/MultiExecTest.php +++ b/tests/Predis/Transaction/MultiExecTest.php @@ -24,7 +24,7 @@ class MultiExecTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage The current profile does not support MULTI, EXEC and DISCARD + * @expectedExceptionMessage The current profile does not support MULTI, EXEC and DISCARD. */ public function testThrowsExceptionOnUnsupportedMultiExecInProfile() { @@ -36,7 +36,7 @@ class MultiExecTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage WATCH is not supported by the current profile + * @expectedExceptionMessage WATCH is not supported by the current profile. */ public function testThrowsExceptionOnUnsupportedWatchInProfile() { @@ -50,7 +50,7 @@ class MultiExecTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\NotSupportedException - * @expectedExceptionMessage UNWATCH is not supported by the current profile + * @expectedExceptionMessage UNWATCH is not supported by the current profile. */ public function testThrowsExceptionOnUnsupportedUnwatchInProfile() { @@ -142,7 +142,7 @@ class MultiExecTest extends PredisTestCase /** * @group disconnected * @expectedException Predis\ClientException - * @expectedExceptionMessage Cannot invoke "execute" or "exec" inside an active transaction context + * @expectedExceptionMessage Cannot invoke "execute" or "exec" inside an active transaction context. */ public function testThrowsExceptionOnExecInsideTransactionBlock() { @@ -369,7 +369,7 @@ class MultiExecTest extends PredisTestCase /** * @group disconnected * @expectedException InvalidArgumentException - * @expectedExceptionMessage Automatic retries can be used only when a callable block is provided + * @expectedExceptionMessage Automatic retries are supported only when a callable block is provided. */ public function testThrowsExceptionOnAutomaticRetriesWithFluentInterface() {