Browse Source

Rationalize API renaming or moving stuff in Predis\Protocol namespace.

Daniele Alessandri 11 years ago
parent
commit
9136033eea
25 changed files with 95 additions and 100 deletions
  1. 8 6
      lib/Predis/Connection/ComposableStreamConnection.php
  2. 1 1
      lib/Predis/Protocol/ProtocolProcessorInterface.php
  3. 4 4
      lib/Predis/Protocol/Text/ComposableProtocolProcessor.php
  4. 2 3
      lib/Predis/Protocol/Text/Handler/BulkResponse.php
  5. 2 3
      lib/Predis/Protocol/Text/Handler/ErrorResponse.php
  6. 2 3
      lib/Predis/Protocol/Text/Handler/IntegerResponse.php
  7. 2 3
      lib/Predis/Protocol/Text/Handler/MultiBulkResponse.php
  8. 1 1
      lib/Predis/Protocol/Text/Handler/ResponseHandlerInterface.php
  9. 2 3
      lib/Predis/Protocol/Text/Handler/StatusResponse.php
  10. 2 3
      lib/Predis/Protocol/Text/Handler/StreamableMultiBulkResponse.php
  11. 3 3
      lib/Predis/Protocol/Text/ProtocolProcessor.php
  12. 1 1
      lib/Predis/Protocol/Text/RequestSerializer.php
  13. 8 9
      lib/Predis/Protocol/Text/ResponseReader.php
  14. 2 2
      tests/Predis/Iterator/MultiBulkResponseSimpleTest.php
  15. 2 2
      tests/Predis/Iterator/MultiBulkResponseTupleTest.php
  16. 9 9
      tests/Predis/Protocol/Text/ComposableProtocolProcessorTest.php
  17. 5 5
      tests/Predis/Protocol/Text/Handler/BulkResponseTest.php
  18. 2 2
      tests/Predis/Protocol/Text/Handler/ErrorResponseTest.php
  19. 4 4
      tests/Predis/Protocol/Text/Handler/IntegerResponse.php
  20. 5 5
      tests/Predis/Protocol/Text/Handler/MultiBulkResponse.php
  21. 4 4
      tests/Predis/Protocol/Text/Handler/StatusResponseTest.php
  22. 3 3
      tests/Predis/Protocol/Text/Handler/StreamableMultiBulkResponse.php
  23. 5 5
      tests/Predis/Protocol/Text/ProtocolProcessorTest.php
  24. 3 3
      tests/Predis/Protocol/Text/RequestSerializerTest.php
  25. 13 13
      tests/Predis/Protocol/Text/ResponseReaderTest.php

+ 8 - 6
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();
     }
 
     /**

+ 1 - 1
lib/Predis/Protocol/ProtocolInterface.php → lib/Predis/Protocol/ProtocolProcessorInterface.php

@@ -20,7 +20,7 @@ use Predis\Connection\ComposableConnectionInterface;
  *
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-interface ProtocolInterface
+interface ProtocolProcessorInterface
 {
     /**
      * Writes a command to the specified connection.

+ 4 - 4
lib/Predis/Protocol/Text/ComposableTextProtocol.php → 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 <suppakilla@gmail.com>
  */
-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());
     }
 
     /**

+ 2 - 3
lib/Predis/Protocol/Text/ResponseBulkHandler.php → 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 <suppakilla@gmail.com>
  */
-class ResponseBulkHandler implements ResponseHandlerInterface
+class BulkResponse implements ResponseHandlerInterface
 {
     /**
      * {@inheritdoc}

+ 2 - 3
lib/Predis/Protocol/Text/ResponseErrorHandler.php → 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 <suppakilla@gmail.com>
  */
-class ResponseErrorHandler implements ResponseHandlerInterface
+class ErrorResponse implements ResponseHandlerInterface
 {
     /**
      * {@inheritdoc}

+ 2 - 3
lib/Predis/Protocol/Text/ResponseIntegerHandler.php → 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 <suppakilla@gmail.com>
  */
-class ResponseIntegerHandler implements ResponseHandlerInterface
+class IntegerResponse implements ResponseHandlerInterface
 {
     /**
      * {@inheritdoc}

+ 2 - 3
lib/Predis/Protocol/Text/ResponseMultiBulkHandler.php → 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 <suppakilla@gmail.com>
  */
-class ResponseMultiBulkHandler implements ResponseHandlerInterface
+class MultiBulkResponse implements ResponseHandlerInterface
 {
     /**
      * {@inheritdoc}

+ 1 - 1
lib/Predis/Protocol/ResponseHandlerInterface.php → 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;
 

+ 2 - 3
lib/Predis/Protocol/Text/ResponseStatusHandler.php → 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 <suppakilla@gmail.com>
  */
-class ResponseStatusHandler implements ResponseHandlerInterface
+class StatusResponse implements ResponseHandlerInterface
 {
     /**
      * {@inheritdoc}

+ 2 - 3
lib/Predis/Protocol/Text/ResponseMultiBulkStreamHandler.php → 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 <suppakilla@gmail.com>
  */
-class ResponseMultiBulkStreamHandler implements ResponseHandlerInterface
+class StreamableMultiBulkResponse implements ResponseHandlerInterface
 {
     /**
      * {@inheritdoc}

+ 3 - 3
lib/Predis/Protocol/Text/TextProtocol.php → 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 <suppakilla@gmail.com>
  */
-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();
     }
 
     /**

+ 1 - 1
lib/Predis/Protocol/Text/TextRequestSerializer.php → lib/Predis/Protocol/Text/RequestSerializer.php

@@ -20,7 +20,7 @@ use Predis\Protocol\RequestSerializerInterface;
  * @link http://redis.io/topics/protocol
  * @author Daniele Alessandri <suppakilla@gmail.com>
  */
-class TextRequestSerializer implements RequestSerializerInterface
+class RequestSerializer implements RequestSerializerInterface
 {
     /**
      * {@inheritdoc}

+ 8 - 9
lib/Predis/Protocol/Text/TextResponseReader.php → 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 <suppakilla@gmail.com>
  */
-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;
     }

+ 2 - 2
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);

+ 2 - 2
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);

+ 9 - 9
tests/Predis/Protocol/Text/ComposableTextProtocolTest.php → 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')

+ 5 - 5
tests/Predis/Protocol/Text/ResponseBulkHandlerTest.php → 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');
 

+ 2 - 2
tests/Predis/Protocol/Text/ResponseErrorHandlerTest.php → 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');
 

+ 4 - 4
tests/Predis/Protocol/Text/ResponseIntegerHandlerTest.php → 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');
 

+ 5 - 5
tests/Predis/Protocol/Text/ResponseMultiBulkHandlerTest.php → 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');
 

+ 4 - 4
tests/Predis/Protocol/Text/ResponseStatusHandlerTest.php → 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');
 

+ 3 - 3
tests/Predis/Protocol/Text/ResponseMultiBulkStreamHandlerTest.php → 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');
 

+ 5 - 5
tests/Predis/Protocol/Text/TextProtocolTest.php → 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');
 

+ 3 - 3
tests/Predis/Protocol/Text/TextRequestSerializerTest.php → 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');
 

+ 13 - 13
tests/Predis/Protocol/Text/TextResponseReaderTest.php → 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');