diff --git a/lib/Predis/Connection/ComposableStreamConnection.php b/lib/Predis/Connection/ComposableStreamConnection.php index 4383ed0b..6adf8b75 100644 --- a/lib/Predis/Connection/ComposableStreamConnection.php +++ b/lib/Predis/Connection/ComposableStreamConnection.php @@ -12,8 +12,8 @@ namespace Predis\Connection; use Predis\Command\CommandInterface; -use Predis\Protocol\ProtocolInterface; -use Predis\Protocol\Text\TextProtocol; +use Predis\Protocol\ProtocolProcessorInterface; +use Predis\Protocol\Text\ProtocolProcessor as TextProtocolProcessor; /** * Connection abstraction to Redis servers based on PHP's stream that uses an @@ -27,12 +27,14 @@ class ComposableStreamConnection extends StreamConnection implements ComposableC /** * @param ConnectionParametersInterface $parameters Parameters used to initialize the connection. - * @param ProtocolInterface $protocol A protocol processor. + * @param ProtocolProcessorInterface $protocol Protocol processor. */ - public function __construct(ConnectionParametersInterface $parameters, ProtocolInterface $protocol = null) - { + public function __construct( + ConnectionParametersInterface $parameters, + ProtocolProcessorInterface $protocol = null + ) { $this->parameters = $this->checkParameters($parameters); - $this->protocol = $protocol ?: new TextProtocol(); + $this->protocol = $protocol ?: new TextProtocolProcessor(); } /** diff --git a/lib/Predis/Protocol/ProtocolInterface.php b/lib/Predis/Protocol/ProtocolProcessorInterface.php similarity index 96% rename from lib/Predis/Protocol/ProtocolInterface.php rename to lib/Predis/Protocol/ProtocolProcessorInterface.php index d8bab0e2..90230f2e 100644 --- a/lib/Predis/Protocol/ProtocolInterface.php +++ b/lib/Predis/Protocol/ProtocolProcessorInterface.php @@ -20,7 +20,7 @@ use Predis\Connection\ComposableConnectionInterface; * * @author Daniele Alessandri */ -interface ProtocolInterface +interface ProtocolProcessorInterface { /** * Writes a command to the specified connection. diff --git a/lib/Predis/Protocol/Text/ComposableTextProtocol.php b/lib/Predis/Protocol/Text/ComposableProtocolProcessor.php similarity index 90% rename from lib/Predis/Protocol/Text/ComposableTextProtocol.php rename to lib/Predis/Protocol/Text/ComposableProtocolProcessor.php index ed5abc1b..facddae9 100644 --- a/lib/Predis/Protocol/Text/ComposableTextProtocol.php +++ b/lib/Predis/Protocol/Text/ComposableProtocolProcessor.php @@ -13,8 +13,8 @@ namespace Predis\Protocol\Text; use Predis\Command\CommandInterface; use Predis\Connection\ComposableConnectionInterface; +use Predis\Protocol\ProtocolProcessorInterface; use Predis\Protocol\RequestSerializerInterface; -use Predis\Protocol\ProtocolInterface; use Predis\Protocol\ResponseReaderInterface; /** @@ -24,7 +24,7 @@ use Predis\Protocol\ResponseReaderInterface; * @link http://redis.io/topics/protocol * @author Daniele Alessandri */ -class ComposableTextProtocol implements ProtocolInterface +class ComposableProtocolProcessor implements ProtocolProcessorInterface { private $serializer; private $reader; @@ -37,8 +37,8 @@ class ComposableTextProtocol implements ProtocolInterface RequestSerializerInterface $serializer = null, ResponseReaderInterface $reader = null ) { - $this->setRequestSerializer($serializer ?: new TextRequestSerializer()); - $this->setResponseReader($reader ?: new TextResponseReader()); + $this->setRequestSerializer($serializer ?: new RequestSerializer()); + $this->setResponseReader($reader ?: new ResponseReader()); } /** diff --git a/lib/Predis/Protocol/Text/ResponseBulkHandler.php b/lib/Predis/Protocol/Text/Handler/BulkResponse.php similarity index 89% rename from lib/Predis/Protocol/Text/ResponseBulkHandler.php rename to lib/Predis/Protocol/Text/Handler/BulkResponse.php index eb2d7693..6de4d61a 100644 --- a/lib/Predis/Protocol/Text/ResponseBulkHandler.php +++ b/lib/Predis/Protocol/Text/Handler/BulkResponse.php @@ -9,12 +9,11 @@ * file that was distributed with this source code. */ -namespace Predis\Protocol\Text; +namespace Predis\Protocol\Text\Handler; use Predis\CommunicationException; use Predis\Connection\ComposableConnectionInterface; use Predis\Protocol\ProtocolException; -use Predis\Protocol\ResponseHandlerInterface; /** * Handler for the bulk response type of the standard Redis wire protocol. @@ -23,7 +22,7 @@ use Predis\Protocol\ResponseHandlerInterface; * @link http://redis.io/topics/protocol * @author Daniele Alessandri */ -class ResponseBulkHandler implements ResponseHandlerInterface +class BulkResponse implements ResponseHandlerInterface { /** * {@inheritdoc} diff --git a/lib/Predis/Protocol/Text/ResponseErrorHandler.php b/lib/Predis/Protocol/Text/Handler/ErrorResponse.php similarity index 85% rename from lib/Predis/Protocol/Text/ResponseErrorHandler.php rename to lib/Predis/Protocol/Text/Handler/ErrorResponse.php index 0368d7d5..f718be89 100644 --- a/lib/Predis/Protocol/Text/ResponseErrorHandler.php +++ b/lib/Predis/Protocol/Text/Handler/ErrorResponse.php @@ -9,11 +9,10 @@ * file that was distributed with this source code. */ -namespace Predis\Protocol\Text; +namespace Predis\Protocol\Text\Handler; use Predis\ResponseError; use Predis\Connection\ComposableConnectionInterface; -use Predis\Protocol\ResponseHandlerInterface; /** * Handler for the error response type of the standard Redis wire protocol. @@ -25,7 +24,7 @@ use Predis\Protocol\ResponseHandlerInterface; * @link http://redis.io/topics/protocol * @author Daniele Alessandri */ -class ResponseErrorHandler implements ResponseHandlerInterface +class ErrorResponse implements ResponseHandlerInterface { /** * {@inheritdoc} diff --git a/lib/Predis/Protocol/Text/ResponseIntegerHandler.php b/lib/Predis/Protocol/Text/Handler/IntegerResponse.php similarity index 87% rename from lib/Predis/Protocol/Text/ResponseIntegerHandler.php rename to lib/Predis/Protocol/Text/Handler/IntegerResponse.php index 0340f9a8..da72dac5 100644 --- a/lib/Predis/Protocol/Text/ResponseIntegerHandler.php +++ b/lib/Predis/Protocol/Text/Handler/IntegerResponse.php @@ -9,12 +9,11 @@ * file that was distributed with this source code. */ -namespace Predis\Protocol\Text; +namespace Predis\Protocol\Text\Handler; use Predis\CommunicationException; use Predis\Connection\ComposableConnectionInterface; use Predis\Protocol\ProtocolException; -use Predis\Protocol\ResponseHandlerInterface; /** * Handler for the integer response type of the standard Redis wire protocol. @@ -23,7 +22,7 @@ use Predis\Protocol\ResponseHandlerInterface; * @link http://redis.io/topics/protocol * @author Daniele Alessandri */ -class ResponseIntegerHandler implements ResponseHandlerInterface +class IntegerResponse implements ResponseHandlerInterface { /** * {@inheritdoc} diff --git a/lib/Predis/Protocol/Text/ResponseMultiBulkHandler.php b/lib/Predis/Protocol/Text/Handler/MultiBulkResponse.php similarity index 92% rename from lib/Predis/Protocol/Text/ResponseMultiBulkHandler.php rename to lib/Predis/Protocol/Text/Handler/MultiBulkResponse.php index 987c1fd1..0ed20ae6 100644 --- a/lib/Predis/Protocol/Text/ResponseMultiBulkHandler.php +++ b/lib/Predis/Protocol/Text/Handler/MultiBulkResponse.php @@ -9,12 +9,11 @@ * file that was distributed with this source code. */ -namespace Predis\Protocol\Text; +namespace Predis\Protocol\Text\Handler; use Predis\CommunicationException; use Predis\Connection\ComposableConnectionInterface; use Predis\Protocol\ProtocolException; -use Predis\Protocol\ResponseHandlerInterface; /** * Handler for the multibulk response type of the standard Redis wire protocol. @@ -23,7 +22,7 @@ use Predis\Protocol\ResponseHandlerInterface; * @link http://redis.io/topics/protocol * @author Daniele Alessandri */ -class ResponseMultiBulkHandler implements ResponseHandlerInterface +class MultiBulkResponse implements ResponseHandlerInterface { /** * {@inheritdoc} diff --git a/lib/Predis/Protocol/ResponseHandlerInterface.php b/lib/Predis/Protocol/Text/Handler/ResponseHandlerInterface.php similarity index 95% rename from lib/Predis/Protocol/ResponseHandlerInterface.php rename to lib/Predis/Protocol/Text/Handler/ResponseHandlerInterface.php index 14b3fd58..222f8a67 100644 --- a/lib/Predis/Protocol/ResponseHandlerInterface.php +++ b/lib/Predis/Protocol/Text/Handler/ResponseHandlerInterface.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Predis\Protocol; +namespace Predis\Protocol\Text\Handler; use Predis\Connection\ComposableConnectionInterface; diff --git a/lib/Predis/Protocol/Text/ResponseStatusHandler.php b/lib/Predis/Protocol/Text/Handler/StatusResponse.php similarity index 87% rename from lib/Predis/Protocol/Text/ResponseStatusHandler.php rename to lib/Predis/Protocol/Text/Handler/StatusResponse.php index f65901cd..b48f0334 100644 --- a/lib/Predis/Protocol/Text/ResponseStatusHandler.php +++ b/lib/Predis/Protocol/Text/Handler/StatusResponse.php @@ -9,11 +9,10 @@ * file that was distributed with this source code. */ -namespace Predis\Protocol\Text; +namespace Predis\Protocol\Text\Handler; use Predis\ResponseQueued; use Predis\Connection\ComposableConnectionInterface; -use Predis\Protocol\ResponseHandlerInterface; /** * Handler for the status response type of the standard Redis wire protocol. @@ -23,7 +22,7 @@ use Predis\Protocol\ResponseHandlerInterface; * @link http://redis.io/topics/protocol * @author Daniele Alessandri */ -class ResponseStatusHandler implements ResponseHandlerInterface +class StatusResponse implements ResponseHandlerInterface { /** * {@inheritdoc} diff --git a/lib/Predis/Protocol/Text/ResponseMultiBulkStreamHandler.php b/lib/Predis/Protocol/Text/Handler/StreamableMultiBulkResponse.php similarity index 89% rename from lib/Predis/Protocol/Text/ResponseMultiBulkStreamHandler.php rename to lib/Predis/Protocol/Text/Handler/StreamableMultiBulkResponse.php index f28614e0..362a573d 100644 --- a/lib/Predis/Protocol/Text/ResponseMultiBulkStreamHandler.php +++ b/lib/Predis/Protocol/Text/Handler/StreamableMultiBulkResponse.php @@ -9,13 +9,12 @@ * file that was distributed with this source code. */ -namespace Predis\Protocol\Text; +namespace Predis\Protocol\Text\Handler; use Predis\CommunicationException; use Predis\Connection\ComposableConnectionInterface; use Predis\Iterator\MultiBulkResponseSimple; use Predis\Protocol\ProtocolException; -use Predis\Protocol\ResponseHandlerInterface; /** * Handler for the multibulk response type of the standard Redis wire protocol. @@ -28,7 +27,7 @@ use Predis\Protocol\ResponseHandlerInterface; * @link http://redis.io/topics/protocol * @author Daniele Alessandri */ -class ResponseMultiBulkStreamHandler implements ResponseHandlerInterface +class StreamableMultiBulkResponse implements ResponseHandlerInterface { /** * {@inheritdoc} diff --git a/lib/Predis/Protocol/Text/TextProtocol.php b/lib/Predis/Protocol/Text/ProtocolProcessor.php similarity index 95% rename from lib/Predis/Protocol/Text/TextProtocol.php rename to lib/Predis/Protocol/Text/ProtocolProcessor.php index 7a8ae1da..04cf2b5c 100644 --- a/lib/Predis/Protocol/Text/TextProtocol.php +++ b/lib/Predis/Protocol/Text/ProtocolProcessor.php @@ -18,7 +18,7 @@ use Predis\Command\CommandInterface; use Predis\Connection\ComposableConnectionInterface; use Predis\Iterator\MultiBulkResponseSimple; use Predis\Protocol\ProtocolException; -use Predis\Protocol\ProtocolInterface; +use Predis\Protocol\ProtocolProcessorInterface; /** * Protocol processor for the standard Redis wire protocol. @@ -26,7 +26,7 @@ use Predis\Protocol\ProtocolInterface; * @link http://redis.io/topics/protocol * @author Daniele Alessandri */ -class TextProtocol implements ProtocolInterface +class ProtocolProcessor implements ProtocolProcessorInterface { const NEWLINE = "\r\n"; const OK = 'OK'; @@ -51,7 +51,7 @@ class TextProtocol implements ProtocolInterface public function __construct() { $this->mbiterable = false; - $this->serializer = new TextRequestSerializer(); + $this->serializer = new RequestSerializer(); } /** diff --git a/lib/Predis/Protocol/Text/TextRequestSerializer.php b/lib/Predis/Protocol/Text/RequestSerializer.php similarity index 94% rename from lib/Predis/Protocol/Text/TextRequestSerializer.php rename to lib/Predis/Protocol/Text/RequestSerializer.php index 59306c71..61508985 100644 --- a/lib/Predis/Protocol/Text/TextRequestSerializer.php +++ b/lib/Predis/Protocol/Text/RequestSerializer.php @@ -20,7 +20,7 @@ use Predis\Protocol\RequestSerializerInterface; * @link http://redis.io/topics/protocol * @author Daniele Alessandri */ -class TextRequestSerializer implements RequestSerializerInterface +class RequestSerializer implements RequestSerializerInterface { /** * {@inheritdoc} diff --git a/lib/Predis/Protocol/Text/TextResponseReader.php b/lib/Predis/Protocol/Text/ResponseReader.php similarity index 80% rename from lib/Predis/Protocol/Text/TextResponseReader.php rename to lib/Predis/Protocol/Text/ResponseReader.php index bd4d2259..51143cdc 100644 --- a/lib/Predis/Protocol/Text/TextResponseReader.php +++ b/lib/Predis/Protocol/Text/ResponseReader.php @@ -14,7 +14,6 @@ namespace Predis\Protocol\Text; use Predis\CommunicationException; use Predis\Connection\ComposableConnectionInterface; use Predis\Protocol\ProtocolException; -use Predis\Protocol\ResponseHandlerInterface; use Predis\Protocol\ResponseReaderInterface; /** @@ -23,7 +22,7 @@ use Predis\Protocol\ResponseReaderInterface; * @link http://redis.io/topics/protocol * @author Daniele Alessandri */ -class TextResponseReader implements ResponseReaderInterface +class ResponseReader implements ResponseReaderInterface { protected $handlers; @@ -43,11 +42,11 @@ class TextResponseReader implements ResponseReaderInterface protected function getDefaultHandlers() { return array( - TextProtocol::PREFIX_STATUS => new ResponseStatusHandler(), - TextProtocol::PREFIX_ERROR => new ResponseErrorHandler(), - TextProtocol::PREFIX_INTEGER => new ResponseIntegerHandler(), - TextProtocol::PREFIX_BULK => new ResponseBulkHandler(), - TextProtocol::PREFIX_MULTI_BULK => new ResponseMultiBulkHandler(), + '+' => new Handler\StatusResponse(), + '-' => new Handler\ErrorResponse(), + ':' => new Handler\IntegerResponse(), + '$' => new Handler\BulkResponse(), + '*' => new Handler\MultiBulkResponse(), ); } @@ -56,9 +55,9 @@ class TextResponseReader implements ResponseReaderInterface * response that can be returned by Redis. * * @param string $prefix Identifier of the type of response. - * @param ResponseHandlerInterface $handler Response handler. + * @param Handler\ResponseHandlerInterface $handler Response handler. */ - public function setHandler($prefix, ResponseHandlerInterface $handler) + public function setHandler($prefix, Handler\ResponseHandlerInterface $handler) { $this->handlers[$prefix] = $handler; } diff --git a/tests/Predis/Iterator/MultiBulkResponseSimpleTest.php b/tests/Predis/Iterator/MultiBulkResponseSimpleTest.php index 8ab7026a..0c3caffa 100644 --- a/tests/Predis/Iterator/MultiBulkResponseSimpleTest.php +++ b/tests/Predis/Iterator/MultiBulkResponseSimpleTest.php @@ -16,7 +16,7 @@ use \PHPUnit_Framework_TestCase as StandardTestCase; use Predis\Client; use Predis\Connection\ComposableStreamConnection; use Predis\Connection\ConnectionParameters; -use Predis\Protocol\Text\TextProtocol; +use Predis\Protocol\Text\ProtocolProcessor as TextProtocolProcessor; /** * @group realm-iterators @@ -130,7 +130,7 @@ class MultiBulkResponseSimpleTest extends StandardTestCase 'profile' => REDIS_SERVER_VERSION, ); - $protocol = new TextProtocol(); + $protocol = new TextProtocolProcessor(); $protocol->useIterableMultibulk(true); $connection = new ComposableStreamConnection($parameters, $protocol); diff --git a/tests/Predis/Iterator/MultiBulkResponseTupleTest.php b/tests/Predis/Iterator/MultiBulkResponseTupleTest.php index 0ce6e3af..46728917 100644 --- a/tests/Predis/Iterator/MultiBulkResponseTupleTest.php +++ b/tests/Predis/Iterator/MultiBulkResponseTupleTest.php @@ -16,7 +16,7 @@ use \PHPUnit_Framework_TestCase as StandardTestCase; use Predis\Client; use Predis\Connection\ComposableStreamConnection; use Predis\Connection\ConnectionParameters; -use Predis\Protocol\Text\TextProtocol; +use Predis\Protocol\Text\ProtocolProcessor as TextProtocolProcessor; /** * @group realm-iterators @@ -116,7 +116,7 @@ class MultiBulkResponseTupleTest extends StandardTestCase 'profile' => REDIS_SERVER_VERSION, ); - $protocol = new TextProtocol(); + $protocol = new TextProtocolProcessor(); $protocol->useIterableMultibulk(true); $connection = new ComposableStreamConnection($parameters, $protocol); diff --git a/tests/Predis/Protocol/Text/ComposableTextProtocolTest.php b/tests/Predis/Protocol/Text/ComposableProtocolProcessorTest.php similarity index 82% rename from tests/Predis/Protocol/Text/ComposableTextProtocolTest.php rename to tests/Predis/Protocol/Text/ComposableProtocolProcessorTest.php index a49658b1..a545fff0 100644 --- a/tests/Predis/Protocol/Text/ComposableTextProtocolTest.php +++ b/tests/Predis/Protocol/Text/ComposableProtocolProcessorTest.php @@ -16,20 +16,20 @@ use \PHPUnit_Framework_TestCase as StandardTestCase; /** * */ -class ComposableTextProtocolTest extends StandardTestCase +class ComposableProtocolProcessorTest extends StandardTestCase { /** * @group disconnected */ public function testConstructor() { - $protocol = new ComposableTextProtocol(); + $protocol = new ComposableProtocolProcessor(); $this->assertInstanceOf( - 'Predis\Protocol\Text\TextRequestSerializer', $protocol->getRequestSerializer() + 'Predis\Protocol\Text\RequestSerializer', $protocol->getRequestSerializer() ); $this->assertInstanceOf( - 'Predis\Protocol\Text\TextResponseReader', $protocol->getResponseReader() + 'Predis\Protocol\Text\ResponseReader', $protocol->getResponseReader() ); } @@ -41,7 +41,7 @@ class ComposableTextProtocolTest extends StandardTestCase $serializer = $this->getMock('Predis\Protocol\RequestSerializerInterface'); $reader = $this->getMock('Predis\Protocol\ResponseReaderInterface'); - $protocol = new ComposableTextProtocol($serializer, $reader); + $protocol = new ComposableProtocolProcessor($serializer, $reader); $this->assertSame($serializer, $protocol->getRequestSerializer()); $this->assertSame($reader, $protocol->getResponseReader()); @@ -54,7 +54,7 @@ class ComposableTextProtocolTest extends StandardTestCase { $serializer = $this->getMock('Predis\Protocol\RequestSerializerInterface'); - $protocol = new ComposableTextProtocol(); + $protocol = new ComposableProtocolProcessor(); $protocol->setRequestSerializer($serializer); $this->assertSame($serializer, $protocol->getRequestSerializer()); @@ -67,7 +67,7 @@ class ComposableTextProtocolTest extends StandardTestCase { $reader = $this->getMock('Predis\Protocol\ResponseReaderInterface'); - $protocol = new ComposableTextProtocol(); + $protocol = new ComposableProtocolProcessor(); $protocol->setResponseReader($reader); $this->assertSame($reader, $protocol->getResponseReader()); @@ -84,7 +84,7 @@ class ComposableTextProtocolTest extends StandardTestCase $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); $serializer = $this->getMock('Predis\Protocol\RequestSerializerInterface'); - $protocol = new ComposableTextProtocol($serializer); + $protocol = new ComposableProtocolProcessor($serializer); $connection->expects($this->once()) ->method('writeBytes') @@ -108,7 +108,7 @@ class ComposableTextProtocolTest extends StandardTestCase $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); $reader = $this->getMock('Predis\Protocol\ResponseReaderInterface'); - $protocol = new ComposableTextProtocol(null, $reader); + $protocol = new ComposableProtocolProcessor(null, $reader); $reader->expects($this->once()) ->method('read') diff --git a/tests/Predis/Protocol/Text/ResponseBulkHandlerTest.php b/tests/Predis/Protocol/Text/Handler/BulkResponseTest.php similarity index 90% rename from tests/Predis/Protocol/Text/ResponseBulkHandlerTest.php rename to tests/Predis/Protocol/Text/Handler/BulkResponseTest.php index f6a25d03..988dc491 100644 --- a/tests/Predis/Protocol/Text/ResponseBulkHandlerTest.php +++ b/tests/Predis/Protocol/Text/Handler/BulkResponseTest.php @@ -16,14 +16,14 @@ use \PHPUnit_Framework_TestCase as StandardTestCase; /** * */ -class ResponseBulkHandlerTest extends StandardTestCase +class BulkResponseTest extends StandardTestCase { /** * @group disconnected */ public function testZeroLengthBulk() { - $handler = new ResponseBulkHandler(); + $handler = new Handler\BulkResponse(); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); @@ -44,7 +44,7 @@ class ResponseBulkHandlerTest extends StandardTestCase $bulk = "This is a bulk string."; $bulkLengh = (string) strlen($bulk); - $handler = new ResponseBulkHandler(); + $handler = new Handler\BulkResponse(); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); @@ -62,7 +62,7 @@ class ResponseBulkHandlerTest extends StandardTestCase */ public function testNull() { - $handler = new ResponseBulkHandler(); + $handler = new Handler\BulkResponse(); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); @@ -79,7 +79,7 @@ class ResponseBulkHandlerTest extends StandardTestCase */ public function testInvalidLength() { - $handler = new ResponseBulkHandler(); + $handler = new Handler\BulkResponse(); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); diff --git a/tests/Predis/Protocol/Text/ResponseErrorHandlerTest.php b/tests/Predis/Protocol/Text/Handler/ErrorResponseTest.php similarity index 89% rename from tests/Predis/Protocol/Text/ResponseErrorHandlerTest.php rename to tests/Predis/Protocol/Text/Handler/ErrorResponseTest.php index 60ce7482..6f2d157f 100644 --- a/tests/Predis/Protocol/Text/ResponseErrorHandlerTest.php +++ b/tests/Predis/Protocol/Text/Handler/ErrorResponseTest.php @@ -16,14 +16,14 @@ use \PHPUnit_Framework_TestCase as StandardTestCase; /** * */ -class ResponseErrorHandlerTest extends StandardTestCase +class ErrorResponseTest extends StandardTestCase { /** * @group disconnected */ public function testOk() { - $handler = new ResponseErrorHandler(); + $handler = new Handler\ErrorResponse(); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); diff --git a/tests/Predis/Protocol/Text/ResponseIntegerHandlerTest.php b/tests/Predis/Protocol/Text/Handler/IntegerResponse.php similarity index 89% rename from tests/Predis/Protocol/Text/ResponseIntegerHandlerTest.php rename to tests/Predis/Protocol/Text/Handler/IntegerResponse.php index e0a6e25b..af7a0c9c 100644 --- a/tests/Predis/Protocol/Text/ResponseIntegerHandlerTest.php +++ b/tests/Predis/Protocol/Text/Handler/IntegerResponse.php @@ -17,14 +17,14 @@ use Predis\ResponseQueued; /** * */ -class ResponseIntegerHandlerTest extends StandardTestCase +class IntegerResponseTest extends StandardTestCase { /** * @group disconnected */ public function testInteger() { - $handler = new ResponseIntegerHandler(); + $handler = new Handler\IntegerResponse(); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); @@ -42,7 +42,7 @@ class ResponseIntegerHandlerTest extends StandardTestCase */ public function testNull() { - $handler = new ResponseIntegerHandler(); + $handler = new Handler\IntegerResponse(); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); @@ -59,7 +59,7 @@ class ResponseIntegerHandlerTest extends StandardTestCase */ public function testInvalid() { - $handler = new ResponseIntegerHandler(); + $handler = new Handler\IntegerResponse(); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); diff --git a/tests/Predis/Protocol/Text/ResponseMultiBulkHandlerTest.php b/tests/Predis/Protocol/Text/Handler/MultiBulkResponse.php similarity index 88% rename from tests/Predis/Protocol/Text/ResponseMultiBulkHandlerTest.php rename to tests/Predis/Protocol/Text/Handler/MultiBulkResponse.php index f1c23cd0..8583d4c6 100644 --- a/tests/Predis/Protocol/Text/ResponseMultiBulkHandlerTest.php +++ b/tests/Predis/Protocol/Text/Handler/MultiBulkResponse.php @@ -16,20 +16,20 @@ use \PHPUnit_Framework_TestCase as StandardTestCase; /** * */ -class ResponseMultiBulkHandlerTest extends StandardTestCase +class MultiBulkResponseTest extends StandardTestCase { /** * @group disconnected */ public function testMultiBulk() { - $handler = new ResponseMultiBulkHandler(); + $handler = new Handler\MultiBulkResponse(); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); $connection->expects($this->once()) ->method('getProtocol') - ->will($this->returnValue(new ComposableTextProtocol())); + ->will($this->returnValue(new ComposableProtocolProcessor())); $connection->expects($this->at(1)) ->method('readLine') @@ -55,7 +55,7 @@ class ResponseMultiBulkHandlerTest extends StandardTestCase */ public function testNull() { - $handler = new ResponseMultiBulkHandler(); + $handler = new Handler\MultiBulkResponse(); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); @@ -72,7 +72,7 @@ class ResponseMultiBulkHandlerTest extends StandardTestCase */ public function testInvalid() { - $handler = new ResponseMultiBulkHandler(); + $handler = new Handler\MultiBulkResponse(); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); diff --git a/tests/Predis/Protocol/Text/ResponseStatusHandlerTest.php b/tests/Predis/Protocol/Text/Handler/StatusResponseTest.php similarity index 88% rename from tests/Predis/Protocol/Text/ResponseStatusHandlerTest.php rename to tests/Predis/Protocol/Text/Handler/StatusResponseTest.php index d09c8537..9c2a49f3 100644 --- a/tests/Predis/Protocol/Text/ResponseStatusHandlerTest.php +++ b/tests/Predis/Protocol/Text/Handler/StatusResponseTest.php @@ -17,14 +17,14 @@ use Predis\ResponseQueued; /** * */ -class ResponseStatusHandlerTest extends StandardTestCase +class StatusResponseTest extends StandardTestCase { /** * @group disconnected */ public function testOk() { - $handler = new ResponseStatusHandler(); + $handler = new Handler\StatusResponse(); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); @@ -39,7 +39,7 @@ class ResponseStatusHandlerTest extends StandardTestCase */ public function testQueued() { - $handler = new ResponseStatusHandler(); + $handler = new Handler\StatusResponse(); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); @@ -54,7 +54,7 @@ class ResponseStatusHandlerTest extends StandardTestCase */ public function testPlainString() { - $handler = new ResponseStatusHandler(); + $handler = new Handler\StatusResponse(); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); diff --git a/tests/Predis/Protocol/Text/ResponseMultiBulkStreamHandlerTest.php b/tests/Predis/Protocol/Text/Handler/StreamableMultiBulkResponse.php similarity index 87% rename from tests/Predis/Protocol/Text/ResponseMultiBulkStreamHandlerTest.php rename to tests/Predis/Protocol/Text/Handler/StreamableMultiBulkResponse.php index ac4165d8..2395aa7a 100644 --- a/tests/Predis/Protocol/Text/ResponseMultiBulkStreamHandlerTest.php +++ b/tests/Predis/Protocol/Text/Handler/StreamableMultiBulkResponse.php @@ -16,14 +16,14 @@ use \PHPUnit_Framework_TestCase as StandardTestCase; /** * */ -class ResponseMultiBulkStreamHandlerTest extends StandardTestCase +class StreamableMultiBulkResponseTest extends StandardTestCase { /** * @group disconnected */ public function testOk() { - $handler = new ResponseMultiBulkStreamHandler(); + $handler = new Handler\StreamableMultiBulkResponse(); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); @@ -40,7 +40,7 @@ class ResponseMultiBulkStreamHandlerTest extends StandardTestCase */ public function testInvalid() { - $handler = new ResponseMultiBulkStreamHandler(); + $handler = new Handler\StreamableMultiBulkResponse(); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); diff --git a/tests/Predis/Protocol/Text/TextProtocolTest.php b/tests/Predis/Protocol/Text/ProtocolProcessorTest.php similarity index 93% rename from tests/Predis/Protocol/Text/TextProtocolTest.php rename to tests/Predis/Protocol/Text/ProtocolProcessorTest.php index 7fbf8b65..f7046a7f 100644 --- a/tests/Predis/Protocol/Text/TextProtocolTest.php +++ b/tests/Predis/Protocol/Text/ProtocolProcessorTest.php @@ -16,7 +16,7 @@ use \PHPUnit_Framework_TestCase as StandardTestCase; /** * */ -class TextProtocolTest extends StandardTestCase +class ProtocolProcessorTest extends StandardTestCase { /** * @group disconnected @@ -24,7 +24,7 @@ class TextProtocolTest extends StandardTestCase public function testConnectionWrite() { $serialized = "*1\r\n$4\r\nPING\r\n"; - $protocol = new TextProtocol(); + $protocol = new ProtocolProcessor(); $command = $this->getMock('Predis\Command\CommandInterface'); @@ -52,7 +52,7 @@ class TextProtocolTest extends StandardTestCase */ public function testConnectionRead() { - $protocol = new TextProtocol(); + $protocol = new ProtocolProcessor(); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); @@ -88,7 +88,7 @@ class TextProtocolTest extends StandardTestCase */ public function testIterableMultibulkSupport() { - $protocol = new TextProtocol(); + $protocol = new ProtocolProcessor(); $protocol->useIterableMultibulk(true); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); @@ -107,7 +107,7 @@ class TextProtocolTest extends StandardTestCase */ public function testUnknownResponsePrefix() { - $protocol = new TextProtocol(); + $protocol = new ProtocolProcessor(); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); diff --git a/tests/Predis/Protocol/Text/TextRequestSerializerTest.php b/tests/Predis/Protocol/Text/RequestSerializerTest.php similarity index 90% rename from tests/Predis/Protocol/Text/TextRequestSerializerTest.php rename to tests/Predis/Protocol/Text/RequestSerializerTest.php index bc7605a9..597be35e 100644 --- a/tests/Predis/Protocol/Text/TextRequestSerializerTest.php +++ b/tests/Predis/Protocol/Text/RequestSerializerTest.php @@ -16,14 +16,14 @@ use \PHPUnit_Framework_TestCase as StandardTestCase; /** * */ -class TextRequestSerializerTest extends StandardTestCase +class RequestSerializerTest extends StandardTestCase { /** * @group disconnected */ public function testSerializerIdWithNoArguments() { - $serializer = new TextRequestSerializer(); + $serializer = new RequestSerializer(); $command = $this->getMock('Predis\Command\CommandInterface'); @@ -45,7 +45,7 @@ class TextRequestSerializerTest extends StandardTestCase */ public function testSerializerIdWithArguments() { - $serializer = new TextRequestSerializer(); + $serializer = new RequestSerializer(); $command = $this->getMock('Predis\Command\CommandInterface'); diff --git a/tests/Predis/Protocol/Text/TextResponseReaderTest.php b/tests/Predis/Protocol/Text/ResponseReaderTest.php similarity index 75% rename from tests/Predis/Protocol/Text/TextResponseReaderTest.php rename to tests/Predis/Protocol/Text/ResponseReaderTest.php index c2887d7f..fac273b8 100644 --- a/tests/Predis/Protocol/Text/TextResponseReaderTest.php +++ b/tests/Predis/Protocol/Text/ResponseReaderTest.php @@ -16,20 +16,20 @@ use \PHPUnit_Framework_TestCase as StandardTestCase; /** * */ -class TextResponseReaderTest extends StandardTestCase +class ResponseReaderTest extends StandardTestCase { /** * @group disconnected */ public function testDefaultHandlers() { - $reader = new TextResponseReader(); + $reader = new ResponseReader(); - $this->assertInstanceOf('Predis\Protocol\Text\ResponseStatusHandler', $reader->getHandler('+')); - $this->assertInstanceOf('Predis\Protocol\Text\ResponseErrorHandler', $reader->getHandler('-')); - $this->assertInstanceOf('Predis\Protocol\Text\ResponseIntegerHandler', $reader->getHandler(':')); - $this->assertInstanceOf('Predis\Protocol\Text\ResponseBulkHandler', $reader->getHandler('$')); - $this->assertInstanceOf('Predis\Protocol\Text\ResponseMultiBulkHandler', $reader->getHandler('*')); + $this->assertInstanceOf('Predis\Protocol\Text\Handler\StatusResponse', $reader->getHandler('+')); + $this->assertInstanceOf('Predis\Protocol\Text\Handler\ErrorResponse', $reader->getHandler('-')); + $this->assertInstanceOf('Predis\Protocol\Text\Handler\IntegerResponse', $reader->getHandler(':')); + $this->assertInstanceOf('Predis\Protocol\Text\Handler\BulkResponse', $reader->getHandler('$')); + $this->assertInstanceOf('Predis\Protocol\Text\Handler\MultiBulkResponse', $reader->getHandler('*')); $this->assertNull($reader->getHandler('!')); } @@ -39,9 +39,9 @@ class TextResponseReaderTest extends StandardTestCase */ public function testReplaceHandler() { - $handler = $this->getMock('Predis\Protocol\ResponseHandlerInterface'); + $handler = $this->getMock('Predis\Protocol\Text\Handler\ResponseHandlerInterface'); - $reader = new TextResponseReader(); + $reader = new ResponseReader(); $reader->setHandler('+', $handler); $this->assertSame($handler, $reader->getHandler('+')); @@ -52,9 +52,9 @@ class TextResponseReaderTest extends StandardTestCase */ public function testReadResponse() { - $reader = new TextResponseReader(); + $reader = new ResponseReader(); - $protocol = new ComposableTextProtocol(); + $protocol = new ComposableProtocolProcessor(); $protocol->setResponseReader($reader); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); @@ -93,7 +93,7 @@ class TextResponseReaderTest extends StandardTestCase */ public function testEmptyResponseHeader() { - $reader = new TextResponseReader(); + $reader = new ResponseReader(); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface'); @@ -110,7 +110,7 @@ class TextResponseReaderTest extends StandardTestCase */ public function testUnknownResponsePrefix() { - $reader = new TextResponseReader(); + $reader = new ResponseReader(); $connection = $this->getMock('Predis\Connection\ComposableConnectionInterface');