Browse Source

Use Predis\Response\Status to identify all kinds of status responses.

Status response objects are needed mostly to make it possible from the
client perspective to differentiate a status response with the payload
"OK" from a normale bulk reply containing "OK".

The biggest change is for commands returning +OK responses: these were
previously translated to TRUE (bool value), but they are now returned
as instances of Predis\Response\Status. Just to illustrate an example
of the possibilities with this change we will use SET since it is the
most widely used command returning +OK:

  $response = $client->set('foo', 'bar');

  echo $response;         // 'OK'
  $response == 'OK';      // TRUE
  isset($response->ok);   // TRUE
  $response == true;      // TRUE
  $response === true;     // FALSE
  $response instanceof Predis\Response\ObjectInterface;     // TRUE
  $response instanceof Predis\Response\Status;              // TRUE

For those checking responses returned by commands such as SET or PONG,
the breaking change basically lies in the usage of strict comparison:
doing $response === true will now evaluate to FALSE instead of TRUE.

By default Predis caches common status responses such as OK or QUEUED
to lower the memory usage when using pipelines or transactions.
Daniele Alessandri 11 years ago
parent
commit
373d30b070
62 changed files with 325 additions and 350 deletions
  1. 6 0
      CHANGELOG.md
  2. 8 9
      examples/PipeliningCommands.php
  3. 1 3
      examples/TransactionWithCAS.php
  4. 2 4
      lib/Predis/Client.php
  5. 0 8
      lib/Predis/Command/ConnectionPing.php
  6. 0 8
      lib/Predis/Command/TransactionUnwatch.php
  7. 0 8
      lib/Predis/Command/TransactionWatch.php
  8. 1 10
      lib/Predis/Connection/PhpiredisConnection.php
  9. 1 10
      lib/Predis/Connection/PhpiredisStreamConnection.php
  10. 1 10
      lib/Predis/Connection/StreamConnection.php
  11. 1 1
      lib/Predis/Connection/WebdisConnection.php
  12. 2 11
      lib/Predis/Protocol/Text/Handler/StatusResponse.php
  13. 1 10
      lib/Predis/Protocol/Text/ProtocolProcessor.php
  14. 81 0
      lib/Predis/Response/Status.php
  15. 0 53
      lib/Predis/Response/StatusQueued.php
  16. 1 1
      lib/Predis/Transaction/MultiExec.php
  17. 16 14
      tests/PHPUnit/PredisConnectionTestCase.php
  18. 6 6
      tests/Predis/ClientTest.php
  19. 5 5
      tests/Predis/Command/ConnectionPingTest.php
  20. 5 5
      tests/Predis/Command/ConnectionQuitTest.php
  21. 2 4
      tests/Predis/Command/ConnectionSelectTest.php
  22. 3 3
      tests/Predis/Command/HashSetMultipleTest.php
  23. 2 2
      tests/Predis/Command/KeyRenameTest.php
  24. 7 7
      tests/Predis/Command/KeyTypeTest.php
  25. 2 2
      tests/Predis/Command/ListSetTest.php
  26. 6 6
      tests/Predis/Command/ListTrimTest.php
  27. 1 1
      tests/Predis/Command/PubSubSubscribeByPatternTest.php
  28. 1 1
      tests/Predis/Command/PubSubSubscribeTest.php
  29. 4 4
      tests/Predis/Command/ServerClientTest.php
  30. 6 10
      tests/Predis/Command/ServerConfigTest.php
  31. 1 1
      tests/Predis/Command/ServerFlushAllTest.php
  32. 2 2
      tests/Predis/Command/ServerFlushDatabaseTest.php
  33. 3 3
      tests/Predis/Command/ServerMonitorTest.php
  34. 3 3
      tests/Predis/Command/ServerScriptTest.php
  35. 1 1
      tests/Predis/Command/ServerSlowlogTest.php
  36. 1 1
      tests/Predis/Command/StringBitOpTest.php
  37. 1 1
      tests/Predis/Command/StringGetTest.php
  38. 2 2
      tests/Predis/Command/StringPreciseSetExpireTest.php
  39. 2 2
      tests/Predis/Command/StringSetExpireTest.php
  40. 2 2
      tests/Predis/Command/StringSetMultipleTest.php
  41. 3 3
      tests/Predis/Command/StringSetTest.php
  42. 3 3
      tests/Predis/Command/TransactionDiscardTest.php
  43. 1 1
      tests/Predis/Command/TransactionExecTest.php
  44. 8 8
      tests/Predis/Command/TransactionMultiTest.php
  45. 3 3
      tests/Predis/Command/TransactionUnwatchTest.php
  46. 9 9
      tests/Predis/Command/TransactionWatchTest.php
  47. 1 1
      tests/Predis/Connection/PhpiredisConnectionTest.php
  48. 1 1
      tests/Predis/Connection/PhpiredisStreamConnectionTest.php
  49. 1 1
      tests/Predis/Connection/WebdisConnectionTest.php
  50. 1 1
      tests/Predis/Monitor/ConsumerTest.php
  51. 9 7
      tests/Predis/Pipeline/AtomicTest.php
  52. 7 5
      tests/Predis/Pipeline/PipelineTest.php
  53. 12 3
      tests/Predis/Protocol/Text/Handler/StatusResponseTest.php
  54. 1 1
      tests/Predis/Protocol/Text/ProtocolProcessorTest.php
  55. 2 2
      tests/Predis/Protocol/Text/ResponseReaderTest.php
  56. 1 1
      tests/Predis/PubSub/ConsumerTest.php
  57. 2 2
      tests/Predis/PubSub/DispatcherLoopTest.php
  58. 4 4
      tests/Predis/Response/Iterator/MultiBulkTest.php
  59. 2 2
      tests/Predis/Response/Iterator/MultiBulkTupleTest.php
  60. 0 51
      tests/Predis/Response/StatusQueuedTest.php
  61. 57 0
      tests/Predis/Response/StatusTest.php
  62. 7 7
      tests/Predis/Transaction/MultiExecTest.php

+ 6 - 0
CHANGELOG.md

@@ -6,6 +6,12 @@ v0.9.0 (201x-xx-xx)
 - Added `SENTINEL` to the profile for Redis 2.6 and `PUBSUB` to the profile for
 - Added `SENTINEL` to the profile for Redis 2.6 and `PUBSUB` to the profile for
   Redis 2.8.
   Redis 2.8.
 
 
+- Status responses are returned as instances of `Predis\Response\Status`, for
+  example +OK is not returned as boolean TRUE anymore which is a breaking change
+  for those using strict comparisons. Status responses can be casted to string
+  values carrying the original payload, so one can do `$response == 'OK'` which
+  is also more akin to how Redis replies to clients.
+
 - Added the `aggregate` client option, useful to fully customize how the client
 - Added the `aggregate` client option, useful to fully customize how the client
   should aggregate multiple connections when an array of connection parameters
   should aggregate multiple connections when an array of connection parameters
   is passed to `Predis\Client::__construct()`.
   is passed to `Predis\Client::__construct()`.

+ 8 - 9
examples/PipeliningCommands.php

@@ -18,7 +18,6 @@ require 'SharedConfigurations.php';
 $client = new Predis\Client($single_server);
 $client = new Predis\Client($single_server);
 
 
 $replies = $client->pipeline(function ($pipe) {
 $replies = $client->pipeline(function ($pipe) {
-    $pipe->ping();
     $pipe->flushdb();
     $pipe->flushdb();
     $pipe->incrby('counter', 10);
     $pipe->incrby('counter', 10);
     $pipe->incrby('counter', 30);
     $pipe->incrby('counter', 30);
@@ -31,14 +30,14 @@ var_export($replies);
 
 
 /* OUTPUT:
 /* OUTPUT:
 array (
 array (
-  0 => true,
-  1 => true,
-  2 => 10,
-  3 => 40,
-  4 => true,
-  5 => '40',
-  6 =>
-  array (
+  0 => Predis\Response\Status::__set_state(array(
+    'payload' => 'OK',
+  )),
+  1 => 10,
+  2 => 40,
+  3 => true,
+  4 => '40',
+  5 => array (
     0 => NULL,
     0 => NULL,
     1 => '40',
     1 => '40',
   ),
   ),

+ 1 - 3
examples/TransactionWithCAS.php

@@ -19,9 +19,7 @@ require 'SharedConfigurations.php';
 //
 //
 // ./redis-cli
 // ./redis-cli
 // SELECT 15
 // SELECT 15
-// ZADD zset 1 a
-// ZADD zset 2 b
-// ZADD zset 3 c
+// ZADD zset 1 a 2 b 3 c
 //
 //
 // Then execute this script four times and see its output.
 // Then execute this script four times and see its output.
 //
 //

+ 2 - 4
lib/Predis/Client.php

@@ -274,11 +274,9 @@ class Client implements ClientInterface
             }
             }
 
 
             return (string) $response;
             return (string) $response;
-        } else if ($response === true) {
-            return 'OK';
-        } else {
-            return $response;
         }
         }
+
+        return $response;
     }
     }
 
 
     /**
     /**

+ 0 - 8
lib/Predis/Command/ConnectionPing.php

@@ -24,12 +24,4 @@ class ConnectionPing extends Command
     {
     {
         return 'PING';
         return 'PING';
     }
     }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function parseResponse($data)
-    {
-        return $data === 'PONG' ? true : false;
-    }
 }
 }

+ 0 - 8
lib/Predis/Command/TransactionUnwatch.php

@@ -24,12 +24,4 @@ class TransactionUnwatch extends Command
     {
     {
         return 'UNWATCH';
         return 'UNWATCH';
     }
     }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function parseResponse($data)
-    {
-        return (bool) $data;
-    }
 }
 }

+ 0 - 8
lib/Predis/Command/TransactionWatch.php

@@ -36,12 +36,4 @@ class TransactionWatch extends Command
 
 
         return $arguments;
         return $arguments;
     }
     }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function parseResponse($data)
-    {
-        return (bool) $data;
-    }
 }
 }

+ 1 - 10
lib/Predis/Connection/PhpiredisConnection.php

@@ -134,16 +134,7 @@ class PhpiredisConnection extends AbstractConnection
     private function getStatusHandler()
     private function getStatusHandler()
     {
     {
         return function ($payload) {
         return function ($payload) {
-            switch ($payload) {
-                case 'OK':
-                    return true;
-
-                case 'QUEUED':
-                    return new Response\StatusQueued();
-
-                default:
-                    return $payload;
-            }
+            return Response\Status::get($payload);
         };
         };
     }
     }
 
 

+ 1 - 10
lib/Predis/Connection/PhpiredisStreamConnection.php

@@ -116,16 +116,7 @@ class PhpiredisStreamConnection extends StreamConnection
     protected function getStatusHandler()
     protected function getStatusHandler()
     {
     {
         return function ($payload) {
         return function ($payload) {
-            switch ($payload) {
-                case 'OK':
-                    return true;
-
-                case 'QUEUED':
-                    return new Response\StatusQueued();
-
-                default:
-                    return $payload;
-            }
+            return Response\Status::get($payload);
         };
         };
     }
     }
 
 

+ 1 - 10
lib/Predis/Connection/StreamConnection.php

@@ -187,16 +187,7 @@ class StreamConnection extends AbstractConnection
 
 
         switch ($prefix) {
         switch ($prefix) {
             case '+':    // inline
             case '+':    // inline
-                switch ($payload) {
-                    case 'OK':
-                        return true;
-
-                    case 'QUEUED':
-                        return new Response\StatusQueued();
-
-                    default:
-                        return $payload;
-                }
+                return Response\Status::get($payload);
 
 
             case '$':    // bulk
             case '$':    // bulk
                 $size = (int) $payload;
                 $size = (int) $payload;

+ 1 - 1
lib/Predis/Connection/WebdisConnection.php

@@ -152,7 +152,7 @@ class WebdisConnection implements SingleConnectionInterface
     protected function getStatusHandler()
     protected function getStatusHandler()
     {
     {
         return function ($payload) {
         return function ($payload) {
-            return $payload === 'OK' ? true : $payload;
+            return Response\Status::get($payload);
         };
         };
     }
     }
 
 

+ 2 - 11
lib/Predis/Protocol/Text/Handler/StatusResponse.php

@@ -27,17 +27,8 @@ class StatusResponse implements ResponseHandlerInterface
     /**
     /**
      * {@inheritdoc}
      * {@inheritdoc}
      */
      */
-    public function handle(ComposableConnectionInterface $connection, $status)
+    public function handle(ComposableConnectionInterface $connection, $payload)
     {
     {
-        switch ($status) {
-            case 'OK':
-                return true;
-
-            case 'QUEUED':
-                return new Response\StatusQueued();
-
-            default:
-                return $status;
-        }
+        return new Response\Status($payload);
     }
     }
 }
 }

+ 1 - 10
lib/Predis/Protocol/Text/ProtocolProcessor.php

@@ -59,16 +59,7 @@ class ProtocolProcessor implements ProtocolProcessorInterface
 
 
         switch ($prefix) {
         switch ($prefix) {
             case '+':    // inline
             case '+':    // inline
-                switch ($payload) {
-                    case 'OK':
-                        return true;
-
-                    case 'QUEUED':
-                        return new Response\StatusQueued();
-
-                    default:
-                        return $payload;
-                }
+                return new Response\Status($payload);
 
 
             case '$':    // bulk
             case '$':    // bulk
                 $size = (int) $payload;
                 $size = (int) $payload;

+ 81 - 0
lib/Predis/Response/Status.php

@@ -0,0 +1,81 @@
+<?php
+
+/*
+ * This file is part of the Predis package.
+ *
+ * (c) Daniele Alessandri <suppakilla@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Predis\Response;
+
+/**
+ * Represents a status response returned by Redis.
+ *
+ * @author Daniele Alessandri <suppakilla@gmail.com>
+ */
+class Status implements ObjectInterface
+{
+    private static $OK;
+    private static $QUEUED;
+
+    private $payload;
+
+    /**
+     * @param string $payload Payload of the status response as returned by Redis.
+     */
+    public function __construct($payload)
+    {
+        $this->payload = $payload;
+    }
+
+    /**
+     * Converts the response object to its string representation.
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return $this->payload;
+    }
+
+    /**
+     * Returns the payload of status response.
+     *
+     * @return string
+     */
+    public function getPayload()
+    {
+        return $this->payload;
+    }
+
+    /**
+     * Returns a new instance of a status response object.
+     *
+     * Common status responses such as OK or QUEUED are cached to lower the
+     * memory usage especially when using pipelines.
+     *
+     * @return string
+     */
+    public static function get($payload)
+    {
+        switch ($payload) {
+            case 'OK':
+                if (!isset(self::$OK)) {
+                    self::$OK = new self('OK');
+                }
+                return self::$OK;
+
+            case 'OK':
+                if (!isset(self::$QUEUED)) {
+                    self::$QUEUED = new self('QUEUED');
+                }
+                return self::$QUEUED;
+
+            default:
+                return new self($payload);
+        }
+    }
+}

+ 0 - 53
lib/Predis/Response/StatusQueued.php

@@ -1,53 +0,0 @@
-<?php
-
-/*
- * This file is part of the Predis package.
- *
- * (c) Daniele Alessandri <suppakilla@gmail.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Predis\Response;
-
-/**
- * Represents a +QUEUED response returned by Redis as a reply to each command
- * executed inside a MULTI/ EXEC transaction.
- *
- * @author Daniele Alessandri <suppakilla@gmail.com>
- */
-class StatusQueued implements ObjectInterface
-{
-    /**
-     * Converts the object to its string representation.
-     *
-     * @return string
-     */
-    public function __toString()
-    {
-        return 'QUEUED';
-    }
-
-    /**
-     * Returns the value of the specified property.
-     *
-     * @param string $property Name of the property.
-     * @return mixed
-     */
-    public function __get($property)
-    {
-        return $property === 'queued';
-    }
-
-    /**
-     * Checks if the specified property is set.
-     *
-     * @param string $property Name of the property.
-     * @return Boolean
-     */
-    public function __isset($property)
-    {
-        return $property === 'queued';
-    }
-}

+ 1 - 1
lib/Predis/Transaction/MultiExec.php

@@ -193,7 +193,7 @@ class MultiExec implements BasicClientInterface, ExecutableContextInterface
             return $response;
             return $response;
         }
         }
 
 
-        if (!$response instanceof Response\StatusQueued) {
+        if ($response != 'QUEUED' && !$response instanceof Response\Status) {
             $this->onProtocolError('The server did not respond with a QUEUED status response');
             $this->onProtocolError('The server did not respond with a QUEUED status response');
         }
         }
 
 

+ 16 - 14
tests/PHPUnit/PredisConnectionTestCase.php

@@ -106,7 +106,7 @@ abstract class PredisConnectionTestCase extends PredisTestCase
         $connection = $this->getConnection($profile);
         $connection = $this->getConnection($profile);
         $cmdPing = $profile->createCommand('ping');
         $cmdPing = $profile->createCommand('ping');
 
 
-        $this->assertSame('PONG', $connection->executeCommand($cmdPing));
+        $this->assertEquals('PONG', $connection->executeCommand($cmdPing));
         $this->assertTrue($connection->isConnected());
         $this->assertTrue($connection->isConnected());
     }
     }
 
 
@@ -121,7 +121,7 @@ abstract class PredisConnectionTestCase extends PredisTestCase
         $cmdPing->expects($this->never())
         $cmdPing->expects($this->never())
                 ->method('parseResponse');
                 ->method('parseResponse');
 
 
-        $this->assertSame('PONG', $connection->executeCommand($cmdPing));
+        $this->assertEquals('PONG', $connection->executeCommand($cmdPing));
     }
     }
 
 
     /**
     /**
@@ -131,11 +131,12 @@ abstract class PredisConnectionTestCase extends PredisTestCase
     {
     {
         $connection = $this->getConnection($profile);
         $connection = $this->getConnection($profile);
 
 
-        $cmdPing = $this->getMock($profile->getCommandClass('ping'), array('parseResponse'));
-        $cmdPing->expects($this->never())
+        $cmdEcho = $this->getMock($profile->getCommandClass('echo'), array('parseResponse'));
+        $cmdEcho->setArguments(array('ECHOED'));
+        $cmdEcho->expects($this->never())
                 ->method('parseResponse');
                 ->method('parseResponse');
 
 
-        $connection->writeRequest($cmdPing);
+        $connection->writeRequest($cmdEcho);
         $connection->disconnect();
         $connection->disconnect();
     }
     }
 
 
@@ -146,12 +147,13 @@ abstract class PredisConnectionTestCase extends PredisTestCase
     {
     {
         $connection = $this->getConnection($profile);
         $connection = $this->getConnection($profile);
 
 
-        $cmdPing = $this->getMock($profile->getCommandClass('ping'), array('parseResponse'));
-        $cmdPing->expects($this->never())
+        $cmdEcho = $this->getMock($profile->getCommandClass('echo'), array('parseResponse'));
+        $cmdEcho->setArguments(array('ECHOED'));
+        $cmdEcho->expects($this->never())
                 ->method('parseResponse');
                 ->method('parseResponse');
 
 
-        $connection->writeRequest($cmdPing);
-        $this->assertSame('PONG', $connection->readResponse($cmdPing));
+        $connection->writeRequest($cmdEcho);
+        $this->assertSame('ECHOED', $connection->readResponse($cmdEcho));
     }
     }
 
 
     /**
     /**
@@ -175,7 +177,7 @@ abstract class PredisConnectionTestCase extends PredisTestCase
         $connection->writeRequest($cmdPing);
         $connection->writeRequest($cmdPing);
         $connection->writeRequest($cmdEcho);
         $connection->writeRequest($cmdEcho);
 
 
-        $this->assertSame('PONG', $connection->readResponse($cmdPing));
+        $this->assertEquals('PONG', $connection->readResponse($cmdPing));
         $this->assertSame('ECHOED', $connection->readResponse($cmdEcho));
         $this->assertSame('ECHOED', $connection->readResponse($cmdEcho));
     }
     }
 
 
@@ -210,15 +212,15 @@ abstract class PredisConnectionTestCase extends PredisTestCase
         $connection = $this->getConnection($profile, true);
         $connection = $this->getConnection($profile, true);
 
 
         $connection->writeRequest($profile->createCommand('set', array('foo', 'bar')));
         $connection->writeRequest($profile->createCommand('set', array('foo', 'bar')));
-        $this->assertTrue($connection->read());
+        $this->assertInstanceOf('Predis\Response\Status', $connection->read());
 
 
         $connection->writeRequest($profile->createCommand('ping'));
         $connection->writeRequest($profile->createCommand('ping'));
-        $this->assertSame('PONG', $connection->read());
+        $this->assertInstanceOf('Predis\Response\Status', $connection->read());
 
 
         $connection->writeRequest($profile->createCommand('multi'));
         $connection->writeRequest($profile->createCommand('multi'));
         $connection->writeRequest($profile->createCommand('ping'));
         $connection->writeRequest($profile->createCommand('ping'));
-        $this->assertTrue($connection->read());
-        $this->assertInstanceOf('Predis\Response\StatusQueued', $connection->read());
+        $this->assertInstanceOf('Predis\Response\Status', $connection->read());
+        $this->assertInstanceOf('Predis\Response\Status', $connection->read());
     }
     }
 
 
     /**
     /**

+ 6 - 6
tests/Predis/ClientTest.php

@@ -384,7 +384,7 @@ class ClientTest extends PredisTestCase
         $connection->expects($this->at(0))
         $connection->expects($this->at(0))
                    ->method('executeCommand')
                    ->method('executeCommand')
                    ->with($ping)
                    ->with($ping)
-                   ->will($this->returnValue('PONG'));
+                   ->will($this->returnValue(new Response\Status('PONG')));
         $connection->expects($this->at(1))
         $connection->expects($this->at(1))
                    ->method('executeCommand')
                    ->method('executeCommand')
                    ->with($hgetall)
                    ->with($hgetall)
@@ -392,7 +392,7 @@ class ClientTest extends PredisTestCase
 
 
         $client = new Client($connection);
         $client = new Client($connection);
 
 
-        $this->assertTrue($client->executeCommand($ping));
+        $this->assertEquals('PONG', $client->executeCommand($ping));
         $this->assertSame(array('foo' => 'bar', 'hoge' => 'piyo'), $client->executeCommand($hgetall));
         $this->assertSame(array('foo' => 'bar', 'hoge' => 'piyo'), $client->executeCommand($hgetall));
     }
     }
 
 
@@ -456,7 +456,7 @@ class ClientTest extends PredisTestCase
         $options = array('profile' => $profile);
         $options = array('profile' => $profile);
         $client = $this->getMock('Predis\Client', null, array($connection, $options));
         $client = $this->getMock('Predis\Client', null, array($connection, $options));
 
 
-        $this->assertTrue($client->ping());
+        $this->assertEquals('PONG', $client->ping());
     }
     }
 
 
     /**
     /**
@@ -506,7 +506,7 @@ class ClientTest extends PredisTestCase
         $connection->expects($this->at(0))
         $connection->expects($this->at(0))
                    ->method('executeCommand')
                    ->method('executeCommand')
                    ->with($this->isRedisCommand('SET', array('foo', 'bar')))
                    ->with($this->isRedisCommand('SET', array('foo', 'bar')))
-                   ->will($this->returnValue(true));
+                   ->will($this->returnValue(new Response\Status('OK')));
         $connection->expects($this->at(1))
         $connection->expects($this->at(1))
                    ->method('executeCommand')
                    ->method('executeCommand')
                    ->with($this->isRedisCommand('GET', array('foo')))
                    ->with($this->isRedisCommand('GET', array('foo')))
@@ -535,7 +535,7 @@ class ClientTest extends PredisTestCase
         $connection->expects($this->at(0))
         $connection->expects($this->at(0))
                    ->method('executeCommand')
                    ->method('executeCommand')
                    ->with($this->isRedisCommand('SET', array('foo', 'bar')))
                    ->with($this->isRedisCommand('SET', array('foo', 'bar')))
-                   ->will($this->returnValue(true));
+                   ->will($this->returnValue(new Response\Status('OK')));
         $connection->expects($this->at(1))
         $connection->expects($this->at(1))
                    ->method('executeCommand')
                    ->method('executeCommand')
                    ->with($this->isRedisCommand('GET', array('foo')))
                    ->with($this->isRedisCommand('GET', array('foo')))
@@ -766,7 +766,7 @@ class ClientTest extends PredisTestCase
         $connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
         $connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
         $connection->expects($this->once())
         $connection->expects($this->once())
                    ->method('executeCommand')
                    ->method('executeCommand')
-                   ->will($this->returnValue(new Response\StatusQueued()));
+                   ->will($this->returnValue(new Response\Status('QUEUED')));
 
 
         $txCallback = function ($tx) {
         $txCallback = function ($tx) {
             $tx->ping();
             $tx->ping();

+ 5 - 5
tests/Predis/Command/ConnectionPingTest.php

@@ -52,18 +52,18 @@ class ConnectionPingTest extends PredisCommandTestCase
      */
      */
     public function testParseResponse()
     public function testParseResponse()
     {
     {
-        $command = $this->getCommand();
-
-        $this->assertTrue($command->parseResponse('PONG'));
+        $this->assertSame('PONG', $this->getCommand()->parseResponse('PONG'));
     }
     }
 
 
     /**
     /**
      * @group connected
      * @group connected
      */
      */
-    public function testAlwaysReturnsTrue()
+    public function testAlwaysReturnsStatusResponse()
     {
     {
         $redis = $this->getClient();
         $redis = $this->getClient();
+        $response = $redis->ping();
 
 
-        $this->assertTrue($redis->ping());
+        $this->assertInstanceOf('Predis\Response\Status', $response);
+        $this->assertEquals('PONG', $response);
     }
     }
 }
 }

+ 5 - 5
tests/Predis/Command/ConnectionQuitTest.php

@@ -52,19 +52,19 @@ class ConnectionQuitTest extends PredisCommandTestCase
      */
      */
     public function testParseResponse()
     public function testParseResponse()
     {
     {
-        $command = $this->getCommand();
-
-        $this->assertTrue($command->parseResponse(true));
+        $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
     }
     }
 
 
     /**
     /**
      * @group connected
      * @group connected
      */
      */
-    public function testReturnsTrueWhenClosingConnection()
+    public function testReturnsStatusResponseWhenClosingConnection()
     {
     {
         $redis = $this->getClient();
         $redis = $this->getClient();
         $command = $this->getCommand();
         $command = $this->getCommand();
+        $response = $redis->executeCommand($command);
 
 
-        $this->assertTrue($redis->executeCommand($command));
+        $this->assertInstanceOf('Predis\Response\Status', $response);
+        $this->assertEquals('OK', $response);
     }
     }
 }
 }

+ 2 - 4
tests/Predis/Command/ConnectionSelectTest.php

@@ -52,9 +52,7 @@ class ConnectionSelectTest extends PredisCommandTestCase
      */
      */
     public function testParseResponse()
     public function testParseResponse()
     {
     {
-        $command = $this->getCommand();
-
-        $this->assertTrue($command->parseResponse(true));
+        $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
     }
     }
 
 
     /**
     /**
@@ -66,7 +64,7 @@ class ConnectionSelectTest extends PredisCommandTestCase
 
 
         $redis->set('foo', 'bar');
         $redis->set('foo', 'bar');
 
 
-        $this->assertTrue($redis->select(REDIS_SERVER_DBNUM - 1));
+        $this->assertEquals('OK', $redis->select(REDIS_SERVER_DBNUM - 1));
         $this->assertFalse($redis->exists('foo'));
         $this->assertFalse($redis->exists('foo'));
     }
     }
 
 

+ 3 - 3
tests/Predis/Command/HashSetMultipleTest.php

@@ -66,7 +66,7 @@ class HashSetMultipleTest extends PredisCommandTestCase
      */
      */
     public function testParseResponse()
     public function testParseResponse()
     {
     {
-        $this->assertTrue($this->getCommand()->parseResponse(true));
+        $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
     }
     }
 
 
     /**
     /**
@@ -76,10 +76,10 @@ class HashSetMultipleTest extends PredisCommandTestCase
     {
     {
         $redis = $this->getClient();
         $redis = $this->getClient();
 
 
-        $this->assertTrue($redis->hmset('metavars', 'foo', 'bar', 'hoge', 'piyo'));
+        $this->assertEquals('OK', $redis->hmset('metavars', 'foo', 'bar', 'hoge', 'piyo'));
         $this->assertSame(array('foo' => 'bar', 'hoge' => 'piyo'), $redis->hgetall('metavars'));
         $this->assertSame(array('foo' => 'bar', 'hoge' => 'piyo'), $redis->hgetall('metavars'));
 
 
-        $this->assertTrue($redis->hmset('metavars', 'foo', 'barbar', 'lol', 'wut'));
+        $this->assertEquals('OK', $redis->hmset('metavars', 'foo', 'barbar', 'lol', 'wut'));
         $this->assertSame(array('foo' => 'barbar', 'hoge' => 'piyo', 'lol' => 'wut'), $redis->hgetall('metavars'));
         $this->assertSame(array('foo' => 'barbar', 'hoge' => 'piyo', 'lol' => 'wut'), $redis->hgetall('metavars'));
     }
     }
 
 

+ 2 - 2
tests/Predis/Command/KeyRenameTest.php

@@ -52,7 +52,7 @@ class KeyRenameTest extends PredisCommandTestCase
      */
      */
     public function testParseResponse()
     public function testParseResponse()
     {
     {
-        $this->assertTrue($this->getCommand()->parseResponse(true));
+        $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
     }
     }
 
 
     /**
     /**
@@ -64,7 +64,7 @@ class KeyRenameTest extends PredisCommandTestCase
 
 
         $redis->set('foo', 'bar');
         $redis->set('foo', 'bar');
 
 
-        $this->assertTrue($redis->rename('foo', 'foofoo'));
+        $this->assertEquals('OK', $redis->rename('foo', 'foofoo'));
         $this->assertFalse($redis->exists('foo'));
         $this->assertFalse($redis->exists('foo'));
         $this->assertTrue($redis->exists('foofoo'));
         $this->assertTrue($redis->exists('foofoo'));
     }
     }

+ 7 - 7
tests/Predis/Command/KeyTypeTest.php

@@ -52,7 +52,7 @@ class KeyTypeTest extends PredisCommandTestCase
      */
      */
     public function testParseResponse()
     public function testParseResponse()
     {
     {
-        $this->assertSame('type', $this->getCommand()->parseResponse('type'));
+        $this->assertSame('none', $this->getCommand()->parseResponse('none'));
     }
     }
 
 
     /**
     /**
@@ -62,21 +62,21 @@ class KeyTypeTest extends PredisCommandTestCase
     {
     {
         $redis = $this->getClient();
         $redis = $this->getClient();
 
 
-        $this->assertSame('none', $redis->type('type:keydoesnotexist'));
+        $this->assertEquals('none', $redis->type('type:keydoesnotexist'));
 
 
         $redis->set('type:string', 'foobar');
         $redis->set('type:string', 'foobar');
-        $this->assertSame('string', $redis->type('type:string'));
+        $this->assertEquals('string', $redis->type('type:string'));
 
 
         $redis->lpush('type:list', 'foobar');
         $redis->lpush('type:list', 'foobar');
-        $this->assertSame('list', $redis->type('type:list'));
+        $this->assertEquals('list', $redis->type('type:list'));
 
 
         $redis->sadd('type:set', 'foobar');
         $redis->sadd('type:set', 'foobar');
-        $this->assertSame('set', $redis->type('type:set'));
+        $this->assertEquals('set', $redis->type('type:set'));
 
 
         $redis->zadd('type:zset', 0, 'foobar');
         $redis->zadd('type:zset', 0, 'foobar');
-        $this->assertSame('zset', $redis->type('type:zset'));
+        $this->assertEquals('zset', $redis->type('type:zset'));
 
 
         $redis->hset('type:hash', 'foo', 'bar');
         $redis->hset('type:hash', 'foo', 'bar');
-        $this->assertSame('hash', $redis->type('type:hash'));
+        $this->assertEquals('hash', $redis->type('type:hash'));
     }
     }
 }
 }

+ 2 - 2
tests/Predis/Command/ListSetTest.php

@@ -52,7 +52,7 @@ class ListSetTest extends PredisCommandTestCase
      */
      */
     public function testParseResponse()
     public function testParseResponse()
     {
     {
-        $this->assertTrue($this->getCommand()->parseResponse(true));
+        $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
     }
     }
 
 
     /**
     /**
@@ -64,7 +64,7 @@ class ListSetTest extends PredisCommandTestCase
 
 
         $redis->rpush('letters', 'a', 'b', 'c');
         $redis->rpush('letters', 'a', 'b', 'c');
 
 
-        $this->assertTrue($redis->lset('letters', 1, 'B'));
+        $this->assertEquals('OK', $redis->lset('letters', 1, 'B'));
         $this->assertSame(array('a', 'B', 'c'), $redis->lrange('letters', 0, -1));
         $this->assertSame(array('a', 'B', 'c'), $redis->lrange('letters', 0, -1));
     }
     }
 
 

+ 6 - 6
tests/Predis/Command/ListTrimTest.php

@@ -52,7 +52,7 @@ class ListTrimTest extends PredisCommandTestCase
      */
      */
     public function testParseResponse()
     public function testParseResponse()
     {
     {
-        $this->assertTrue($this->getCommand()->parseResponse(true));
+        $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
     }
     }
 
 
     /**
     /**
@@ -64,13 +64,13 @@ class ListTrimTest extends PredisCommandTestCase
 
 
         $redis->rpush('letters', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'l');
         $redis->rpush('letters', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'l');
 
 
-        $this->assertTrue($redis->ltrim('letters', 0, 2));
+        $this->assertEquals('OK', $redis->ltrim('letters', 0, 2));
         $this->assertSame(array('a', 'b', 'c'), $redis->lrange('letters', 0, -1));
         $this->assertSame(array('a', 'b', 'c'), $redis->lrange('letters', 0, -1));
 
 
         $redis->flushdb();
         $redis->flushdb();
         $redis->rpush('letters', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'l');
         $redis->rpush('letters', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'l');
 
 
-        $this->assertTrue($redis->ltrim('letters', 5, 9));
+        $this->assertEquals('OK', $redis->ltrim('letters', 5, 9));
         $this->assertSame(array('f', 'g', 'h', 'i', 'l'), $redis->lrange('letters', 0, -1));
         $this->assertSame(array('f', 'g', 'h', 'i', 'l'), $redis->lrange('letters', 0, -1));
     }
     }
 
 
@@ -83,7 +83,7 @@ class ListTrimTest extends PredisCommandTestCase
 
 
         $redis->rpush('letters', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'l');
         $redis->rpush('letters', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'l');
 
 
-        $this->assertTrue($redis->ltrim('letters', 0, -6));
+        $this->assertEquals('OK', $redis->ltrim('letters', 0, -6));
         $this->assertSame(array('a', 'b', 'c', 'd', 'e'), $redis->lrange('letters', 0, -1));
         $this->assertSame(array('a', 'b', 'c', 'd', 'e'), $redis->lrange('letters', 0, -1));
     }
     }
 
 
@@ -96,7 +96,7 @@ class ListTrimTest extends PredisCommandTestCase
 
 
         $redis->rpush('letters', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'l');
         $redis->rpush('letters', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'l');
 
 
-        $this->assertTrue($redis->ltrim('letters', -5, -5));
+        $this->assertEquals('OK', $redis->ltrim('letters', -5, -5));
         $this->assertSame(array('f'), $redis->lrange('letters', 0, -1));
         $this->assertSame(array('f'), $redis->lrange('letters', 0, -1));
     }
     }
 
 
@@ -109,7 +109,7 @@ class ListTrimTest extends PredisCommandTestCase
 
 
         $redis->rpush('letters', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'l');
         $redis->rpush('letters', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'l');
 
 
-        $this->assertTrue($redis->ltrim('letters', -100, 100));
+        $this->assertEquals('OK', $redis->ltrim('letters', -100, 100));
         $this->assertSame(array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'l'), $redis->lrange('letters', -100, 100));
         $this->assertSame(array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'l'), $redis->lrange('letters', -100, 100));
     }
     }
 
 

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

@@ -139,7 +139,7 @@ class PubSubSubscribeByPatternTest extends PredisCommandTestCase
         $quit = $this->getProfile()->createCommand('quit');
         $quit = $this->getProfile()->createCommand('quit');
 
 
         $this->assertSame(array('subscribe', 'channel1', 1), $redis->subscribe('channel1'));
         $this->assertSame(array('subscribe', 'channel1', 1), $redis->subscribe('channel1'));
-        $this->assertTrue($redis->executeCommand($quit));
+        $this->assertEquals('OK', $redis->executeCommand($quit));
     }
     }
 
 
     /**
     /**

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

@@ -139,7 +139,7 @@ class PubSubSubscribeTest extends PredisCommandTestCase
         $quit = $this->getProfile()->createCommand('quit');
         $quit = $this->getProfile()->createCommand('quit');
 
 
         $this->assertSame(array('subscribe', 'channel:foo', 1), $redis->subscribe('channel:foo'));
         $this->assertSame(array('subscribe', 'channel:foo', 1), $redis->subscribe('channel:foo'));
-        $this->assertTrue($redis->executeCommand($quit));
+        $this->assertEquals('OK', $redis->executeCommand($quit));
     }
     }
 
 
     /**
     /**

+ 4 - 4
tests/Predis/Command/ServerClientTest.php

@@ -153,7 +153,7 @@ BUFFER;
          $this->assertNull($clientName);
          $this->assertNull($clientName);
 
 
          $expectedConnectionName = 'foo-bar';
          $expectedConnectionName = 'foo-bar';
-         $this->assertTrue($redis->client('SETNAME', $expectedConnectionName));
+         $this->assertEquals('OK', $redis->client('SETNAME', $expectedConnectionName));
          $this->assertEquals($expectedConnectionName, $redis->client('GETNAME'));
          $this->assertEquals($expectedConnectionName, $redis->client('GETNAME'));
     }
     }
 
 
@@ -167,7 +167,7 @@ BUFFER;
          $redis = $this->getClient();
          $redis = $this->getClient();
 
 
          $expectedConnectionName = 'foo-baz';
          $expectedConnectionName = 'foo-baz';
-         $this->assertTrue($redis->client('SETNAME', $expectedConnectionName));
+         $this->assertEquals('OK', $redis->client('SETNAME', $expectedConnectionName));
          $this->assertEquals($expectedConnectionName, $redis->client('GETNAME'));
          $this->assertEquals($expectedConnectionName, $redis->client('GETNAME'));
     }
     }
 
 
@@ -204,7 +204,7 @@ BUFFER;
     {
     {
         $redis = $this->getClient();
         $redis = $this->getClient();
 
 
-        $this->assertTrue($redis->client('FOO'));
+        $redis->client('FOO');
     }
     }
 
 
     /**
     /**
@@ -216,6 +216,6 @@ BUFFER;
     {
     {
         $redis = $this->getClient();
         $redis = $this->getClient();
 
 
-        $this->assertTrue($redis->client('KILL', '127.0.0.1:65535'));
+        $redis->client('KILL', '127.0.0.1:65535');
     }
     }
 }
 }

+ 6 - 10
tests/Predis/Command/ServerConfigTest.php

@@ -69,9 +69,7 @@ class ServerConfigTest extends PredisCommandTestCase
      */
      */
     public function testParseResponseOfConfigSet()
     public function testParseResponseOfConfigSet()
     {
     {
-        $command = $this->getCommand();
-
-        $this->assertTrue($command->parseResponse(true));
+        $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
     }
     }
 
 
     /**
     /**
@@ -79,9 +77,7 @@ class ServerConfigTest extends PredisCommandTestCase
      */
      */
     public function testParseResponseOfConfigResetstat()
     public function testParseResponseOfConfigResetstat()
     {
     {
-        $command = $this->getCommand();
-
-        $this->assertTrue($command->parseResponse(true));
+        $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
     }
     }
 
 
     /**
     /**
@@ -129,7 +125,7 @@ class ServerConfigTest extends PredisCommandTestCase
 
 
         $previous = $redis->config('GET', 'loglevel');
         $previous = $redis->config('GET', 'loglevel');
 
 
-        $this->assertTrue($redis->config('SET', 'loglevel', 'notice'));
+        $this->assertEquals('OK', $redis->config('SET', 'loglevel', 'notice'));
         $this->assertSame(array('loglevel' => 'notice'), $redis->config('GET', 'loglevel'));
         $this->assertSame(array('loglevel' => 'notice'), $redis->config('GET', 'loglevel'));
 
 
         // We set the loglevel configuration to the previous value.
         // We set the loglevel configuration to the previous value.
@@ -145,7 +141,7 @@ class ServerConfigTest extends PredisCommandTestCase
     {
     {
         $redis = $this->getClient();
         $redis = $this->getClient();
 
 
-        $this->assertFalse($redis->config('SET', 'foo', 'bar'));
+        $redis->config('SET', 'foo', 'bar');
     }
     }
 
 
     /**
     /**
@@ -155,7 +151,7 @@ class ServerConfigTest extends PredisCommandTestCase
     {
     {
         $redis = $this->getClient();
         $redis = $this->getClient();
 
 
-        $this->assertTrue($redis->config('RESETSTAT'));
+        $this->assertEquals('OK', $redis->config('RESETSTAT'));
     }
     }
 
 
     /**
     /**
@@ -166,6 +162,6 @@ class ServerConfigTest extends PredisCommandTestCase
     {
     {
         $redis = $this->getClient();
         $redis = $this->getClient();
 
 
-        $this->assertFalse($redis->config('FOO'));
+        $redis->config('FOO');
     }
     }
 }
 }

+ 1 - 1
tests/Predis/Command/ServerFlushAllTest.php

@@ -49,6 +49,6 @@ class ServerFlushAllTest extends PredisCommandTestCase
      */
      */
     public function testParseResponse()
     public function testParseResponse()
     {
     {
-        $this->assertTrue($this->getCommand()->parseResponse(true));
+        $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
     }
     }
 }
 }

+ 2 - 2
tests/Predis/Command/ServerFlushDatabaseTest.php

@@ -49,7 +49,7 @@ class ServerFlushDatabaseTest extends PredisCommandTestCase
      */
      */
     public function testParseResponse()
     public function testParseResponse()
     {
     {
-        $this->assertTrue($this->getCommand()->parseResponse(true));
+        $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
     }
     }
 
 
     /**
     /**
@@ -61,7 +61,7 @@ class ServerFlushDatabaseTest extends PredisCommandTestCase
 
 
         $redis->set('foo', 'bar');
         $redis->set('foo', 'bar');
 
 
-        $this->assertTrue($redis->flushdb());
+        $this->assertEquals('OK', $redis->flushdb());
         $this->assertFalse($redis->exists('foo'));
         $this->assertFalse($redis->exists('foo'));
     }
     }
 }
 }

+ 3 - 3
tests/Predis/Command/ServerMonitorTest.php

@@ -50,18 +50,18 @@ class ServerMonitorTest extends PredisCommandTestCase
      */
      */
     public function testParseResponse()
     public function testParseResponse()
     {
     {
-        $this->assertTrue($this->getCommand()->parseResponse(true));
+        $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
     }
     }
 
 
     /**
     /**
      * @group connected
      * @group connected
      */
      */
-    public function testReturnsTrueAndReadsEventsFromTheConnection()
+    public function testReturnsStatusResponseAndReadsEventsFromTheConnection()
     {
     {
         $connection = $this->getClient()->getConnection();
         $connection = $this->getClient()->getConnection();
         $command = $this->getCommand();
         $command = $this->getCommand();
 
 
-        $this->assertTrue($connection->executeCommand($command));
+        $this->assertEquals('OK', $connection->executeCommand($command));
 
 
         // NOTE: Starting with 2.6 Redis does not return the "MONITOR" message after
         // NOTE: Starting with 2.6 Redis does not return the "MONITOR" message after
         // +OK to the client that issued the MONITOR command.
         // +OK to the client that issued the MONITOR command.

+ 3 - 3
tests/Predis/Command/ServerScriptTest.php

@@ -52,14 +52,14 @@ class ServerScriptTest extends PredisCommandTestCase
      */
      */
     public function testParseResponse()
     public function testParseResponse()
     {
     {
-        $this->assertTrue($this->getCommand()->parseResponse(true));
+        $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
     }
     }
 
 
     /**
     /**
      * @group connected
      * @group connected
      * @todo We should probably convert integers to booleans.
      * @todo We should probably convert integers to booleans.
      */
      */
-    public function testExistsReturnAnArrayOfValues()
+    public function testExistsReturnsAnArrayOfValues()
     {
     {
         $redis = $this->getClient();
         $redis = $this->getClient();
 
 
@@ -91,7 +91,7 @@ class ServerScriptTest extends PredisCommandTestCase
 
 
         $sha1 = $redis->script('LOAD', 'return true');
         $sha1 = $redis->script('LOAD', 'return true');
 
 
-        $this->assertTrue($redis->script('FLUSH'));
+        $this->assertEquals('OK', $redis->script('FLUSH'));
         $this->assertSame(array(0), $redis->script('EXISTS', $sha1));
         $this->assertSame(array(0), $redis->script('EXISTS', $sha1));
     }
     }
 
 

+ 1 - 1
tests/Predis/Command/ServerSlowlogTest.php

@@ -102,7 +102,7 @@ class ServerSlowlogTest extends PredisCommandTestCase
     {
     {
         $redis = $this->getClient();
         $redis = $this->getClient();
 
 
-        $this->assertTrue($redis->slowlog('RESET'));
+        $this->assertEquals('OK', $redis->slowlog('RESET'));
     }
     }
 
 
     /**
     /**

+ 1 - 1
tests/Predis/Command/StringBitOpTest.php

@@ -172,6 +172,6 @@ class StringBitOpTest extends PredisCommandTestCase
         $redis->lpush('key:dst', 'list');
         $redis->lpush('key:dst', 'list');
         $redis->bitop('AND', 'key:dst', 'key:src:1', 'key:src:2');
         $redis->bitop('AND', 'key:dst', 'key:src:1', 'key:src:2');
 
 
-        $this->assertSame('none', $redis->type('key:dst'));
+        $this->assertEquals('none', $redis->type('key:dst'));
     }
     }
 }
 }

+ 1 - 1
tests/Predis/Command/StringGetTest.php

@@ -62,7 +62,7 @@ class StringGetTest extends PredisCommandTestCase
     {
     {
         $redis = $this->getClient();
         $redis = $this->getClient();
 
 
-        $this->assertTrue($redis->set('foo', 'bar'));
+        $this->assertEquals('OK', $redis->set('foo', 'bar'));
         $this->assertEquals('bar', $redis->get('foo'));
         $this->assertEquals('bar', $redis->get('foo'));
     }
     }
 
 

+ 2 - 2
tests/Predis/Command/StringPreciseSetExpireTest.php

@@ -52,7 +52,7 @@ class StringPreciseSetExpireTest extends PredisCommandTestCase
      */
      */
     public function testParseResponse()
     public function testParseResponse()
     {
     {
-        $this->assertTrue($this->getCommand()->parseResponse(true));
+        $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
     }
     }
 
 
     /**
     /**
@@ -62,7 +62,7 @@ class StringPreciseSetExpireTest extends PredisCommandTestCase
     {
     {
         $redis = $this->getClient();
         $redis = $this->getClient();
 
 
-        $this->assertTrue($redis->psetex('foo', 10000, 'bar'));
+        $this->assertEquals('OK', $redis->psetex('foo', 10000, 'bar'));
         $this->assertTrue($redis->exists('foo'));
         $this->assertTrue($redis->exists('foo'));
         $this->assertEquals(10, $redis->ttl('foo'));
         $this->assertEquals(10, $redis->ttl('foo'));
     }
     }

+ 2 - 2
tests/Predis/Command/StringSetExpireTest.php

@@ -52,7 +52,7 @@ class StringSetExpireTest extends PredisCommandTestCase
      */
      */
     public function testParseResponse()
     public function testParseResponse()
     {
     {
-        $this->assertTrue($this->getCommand()->parseResponse(true));
+        $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
     }
     }
 
 
     /**
     /**
@@ -62,7 +62,7 @@ class StringSetExpireTest extends PredisCommandTestCase
     {
     {
         $redis = $this->getClient();
         $redis = $this->getClient();
 
 
-        $this->assertTrue($redis->setex('foo', 10, 'bar'));
+        $this->assertEquals('OK', $redis->setex('foo', 10, 'bar'));
         $this->assertTrue($redis->exists('foo'));
         $this->assertTrue($redis->exists('foo'));
         $this->assertEquals(10, $redis->ttl('foo'));
         $this->assertEquals(10, $redis->ttl('foo'));
     }
     }

+ 2 - 2
tests/Predis/Command/StringSetMultipleTest.php

@@ -66,7 +66,7 @@ class StringSetMultipleTest extends PredisCommandTestCase
      */
      */
     public function testParseResponse()
     public function testParseResponse()
     {
     {
-        $this->assertSame(true, $this->getCommand()->parseResponse(true));
+        $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
     }
     }
 
 
     /**
     /**
@@ -76,7 +76,7 @@ class StringSetMultipleTest extends PredisCommandTestCase
     {
     {
         $redis = $this->getClient();
         $redis = $this->getClient();
 
 
-        $this->assertTrue($redis->mset('foo', 'bar', 'hoge', 'piyo'));
+        $this->assertEquals('OK', $redis->mset('foo', 'bar', 'hoge', 'piyo'));
         $this->assertSame('bar', $redis->get('foo'));
         $this->assertSame('bar', $redis->get('foo'));
         $this->assertSame('piyo', $redis->get('hoge'));
         $this->assertSame('piyo', $redis->get('hoge'));
     }
     }

+ 3 - 3
tests/Predis/Command/StringSetTest.php

@@ -52,7 +52,7 @@ class StringSetTest extends PredisCommandTestCase
      */
      */
     public function testParseResponse()
     public function testParseResponse()
     {
     {
-        $this->assertTrue($this->getCommand()->parseResponse(true));
+        $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
     }
     }
 
 
     /**
     /**
@@ -62,8 +62,8 @@ class StringSetTest extends PredisCommandTestCase
     {
     {
         $redis = $this->getClient();
         $redis = $this->getClient();
 
 
-        $this->assertTrue($redis->set('foo', 'bar'));
+        $this->assertEquals('OK', $redis->set('foo', 'bar'));
         $this->assertTrue($redis->exists('foo'));
         $this->assertTrue($redis->exists('foo'));
-        $this->assertEquals('bar', $redis->get('foo'));
+        $this->assertSame('bar', $redis->get('foo'));
     }
     }
 }
 }

+ 3 - 3
tests/Predis/Command/TransactionDiscardTest.php

@@ -49,7 +49,7 @@ class TransactionDiscardTest extends PredisCommandTestCase
      */
      */
     public function testParseResponse()
     public function testParseResponse()
     {
     {
-        $this->assertTrue($this->getCommand()->parseResponse(true));
+        $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
     }
     }
 
 
     /**
     /**
@@ -61,8 +61,8 @@ class TransactionDiscardTest extends PredisCommandTestCase
 
 
         $redis->multi();
         $redis->multi();
 
 
-        $this->assertInstanceOf('Predis\Response\StatusQueued', $redis->set('foo', 'bar'));
-        $this->assertTrue($redis->discard());
+        $this->assertEquals('QUEUED', $redis->set('foo', 'bar'));
+        $this->assertEquals('OK', $redis->discard());
         $this->assertFalse($redis->exists('foo'));
         $this->assertFalse($redis->exists('foo'));
     }
     }
 
 

+ 1 - 1
tests/Predis/Command/TransactionExecTest.php

@@ -95,7 +95,7 @@ class TransactionExecTest extends PredisCommandTestCase
         $redis->set('foo', 'bar');
         $redis->set('foo', 'bar');
         $redis->exists('foo');
         $redis->exists('foo');
 
 
-        $this->assertSame(array('PONG', true, 1), $redis->exec());
+        $this->assertEquals(array('PONG', 'OK', 1), $redis->exec());
     }
     }
 
 
     /**
     /**

+ 8 - 8
tests/Predis/Command/TransactionMultiTest.php

@@ -49,7 +49,7 @@ class TransactionMultiTest extends PredisCommandTestCase
      */
      */
     public function testParseResponse()
     public function testParseResponse()
     {
     {
-        $this->assertTrue($this->getCommand()->parseResponse(true));
+        $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
     }
     }
 
 
     /**
     /**
@@ -59,21 +59,21 @@ class TransactionMultiTest extends PredisCommandTestCase
     {
     {
         $redis = $this->getClient();
         $redis = $this->getClient();
 
 
-        $this->assertTrue($redis->multi());
-        $this->assertSame('QUEUED', (string) $redis->echo('tx1'));
-        $this->assertSame('QUEUED', (string) $redis->echo('tx2'));
+        $this->assertEquals('OK', $redis->multi());
+        $this->assertEquals('QUEUED', $redis->echo('tx1'));
+        $this->assertEquals('QUEUED', $redis->echo('tx2'));
     }
     }
 
 
     /**
     /**
      * @group connected
      * @group connected
      */
      */
-    public function testActuallyReturnsReplyObjectAbstraction()
+    public function testActuallyReturnsResponseObjectAbstraction()
     {
     {
         $redis = $this->getClient();
         $redis = $this->getClient();
 
 
-        $this->assertTrue($redis->multi());
-        $this->assertInstanceOf('Predis\Response\ObjectInterface', $redis->echo('tx1'));
-        $this->assertInstanceOf('Predis\Response\StatusQueued', $redis->echo('tx2'));
+        $this->assertInstanceOf('Predis\Response\Status', $redis->multi());
+        $this->assertInstanceOf('Predis\Response\Status', $redis->echo('tx1'));
+        $this->assertInstanceOf('Predis\Response\Status', $redis->echo('tx2'));
     }
     }
 
 
     /**
     /**

+ 3 - 3
tests/Predis/Command/TransactionUnwatchTest.php

@@ -49,7 +49,7 @@ class TransactionUnwatchTest extends PredisCommandTestCase
      */
      */
     public function testParseResponse()
     public function testParseResponse()
     {
     {
-        $this->assertTrue($this->getCommand()->parseResponse(true));
+        $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
     }
     }
 
 
     /**
     /**
@@ -62,7 +62,7 @@ class TransactionUnwatchTest extends PredisCommandTestCase
 
 
         $redis1->set('foo', 'bar');
         $redis1->set('foo', 'bar');
         $redis1->watch('foo');
         $redis1->watch('foo');
-        $this->assertTrue($redis1->unwatch());
+        $this->assertEquals('OK', $redis1->unwatch());
         $redis1->multi();
         $redis1->multi();
         $redis1->get('foo');
         $redis1->get('foo');
 
 
@@ -79,6 +79,6 @@ class TransactionUnwatchTest extends PredisCommandTestCase
         $redis = $this->getClient();
         $redis = $this->getClient();
 
 
         $redis->multi();
         $redis->multi();
-        $this->assertInstanceOf('Predis\Response\StatusQueued', $redis->unwatch());
+        $this->assertInstanceOf('Predis\Response\Status', $redis->unwatch());
     }
     }
 }
 }

+ 9 - 9
tests/Predis/Command/TransactionWatchTest.php

@@ -66,7 +66,7 @@ class TransactionWatchTest extends PredisCommandTestCase
      */
      */
     public function testParseResponse()
     public function testParseResponse()
     {
     {
-        $this->assertTrue($this->getCommand()->parseResponse(true));
+        $this->assertSame('OK', $this->getCommand()->parseResponse('OK'));
     }
     }
 
 
     /**
     /**
@@ -79,10 +79,10 @@ class TransactionWatchTest extends PredisCommandTestCase
 
 
         $redis1->mset('foo', 'bar', 'hoge', 'piyo');
         $redis1->mset('foo', 'bar', 'hoge', 'piyo');
 
 
-        $this->assertTrue($redis1->watch('foo', 'hoge'));
-        $this->assertTrue($redis1->multi());
-        $this->assertInstanceOf('Predis\Response\StatusQueued', $redis1->get('foo'));
-        $this->assertTrue($redis2->set('foo', 'hijacked'));
+        $this->assertEquals('OK', $redis1->watch('foo', 'hoge'));
+        $this->assertEquals('OK', $redis1->multi());
+        $this->assertEquals('QUEUED', $redis1->get('foo'));
+        $this->assertEquals('OK', $redis2->set('foo', 'hijacked'));
         $this->assertNull($redis1->exec());
         $this->assertNull($redis1->exec());
         $this->assertSame('hijacked', $redis1->get('foo'));
         $this->assertSame('hijacked', $redis1->get('foo'));
     }
     }
@@ -95,10 +95,10 @@ class TransactionWatchTest extends PredisCommandTestCase
         $redis1 = $this->getClient();
         $redis1 = $this->getClient();
         $redis2 = $this->getClient();
         $redis2 = $this->getClient();
 
 
-        $this->assertTrue($redis1->watch('foo'));
-        $this->assertTrue($redis1->multi());
-        $this->assertInstanceOf('Predis\Response\StatusQueued', $redis1->set('foo', 'bar'));
-        $this->assertTrue($redis2->set('foo', 'hijacked'));
+        $this->assertEquals('OK', $redis1->watch('foo'));
+        $this->assertEquals('OK', $redis1->multi());
+        $this->assertEquals('QUEUED', $redis1->set('foo', 'bar'));
+        $this->assertEquals('OK', $redis2->set('foo', 'hijacked'));
         $this->assertNull($redis1->exec());
         $this->assertNull($redis1->exec());
         $this->assertSame('hijacked', $redis1->get('foo'));
         $this->assertSame('hijacked', $redis1->get('foo'));
     }
     }

+ 1 - 1
tests/Predis/Connection/PhpiredisConnectionTest.php

@@ -79,7 +79,7 @@ class PhpiredisConnectionTest extends PredisConnectionTestCase
         $cmdRpush  = $profile->createCommand('rpush', array('metavars', 'foo', 'hoge', 'lol'));
         $cmdRpush  = $profile->createCommand('rpush', array('metavars', 'foo', 'hoge', 'lol'));
         $cmdLrange = $profile->createCommand('lrange', array('metavars', 0, -1));
         $cmdLrange = $profile->createCommand('lrange', array('metavars', 0, -1));
 
 
-        $this->assertSame('PONG', $connection->executeCommand($cmdPing));
+        $this->assertEquals('PONG', $connection->executeCommand($cmdPing));
         $this->assertSame('echoed', $connection->executeCommand($cmdEcho));
         $this->assertSame('echoed', $connection->executeCommand($cmdEcho));
         $this->assertNull($connection->executeCommand($cmdGet));
         $this->assertNull($connection->executeCommand($cmdGet));
         $this->assertSame(3, $connection->executeCommand($cmdRpush));
         $this->assertSame(3, $connection->executeCommand($cmdRpush));

+ 1 - 1
tests/Predis/Connection/PhpiredisStreamConnectionTest.php

@@ -97,7 +97,7 @@ class PhpiredisStreamConnectionTest extends PredisConnectionTestCase
         $cmdRpush  = $profile->createCommand('rpush', array('metavars', 'foo', 'hoge', 'lol'));
         $cmdRpush  = $profile->createCommand('rpush', array('metavars', 'foo', 'hoge', 'lol'));
         $cmdLrange = $profile->createCommand('lrange', array('metavars', 0, -1));
         $cmdLrange = $profile->createCommand('lrange', array('metavars', 0, -1));
 
 
-        $this->assertSame('PONG', $connection->executeCommand($cmdPing));
+        $this->assertEquals('PONG', $connection->executeCommand($cmdPing));
         $this->assertSame('echoed', $connection->executeCommand($cmdEcho));
         $this->assertSame('echoed', $connection->executeCommand($cmdEcho));
         $this->assertNull($connection->executeCommand($cmdGet));
         $this->assertNull($connection->executeCommand($cmdGet));
         $this->assertSame(3, $connection->executeCommand($cmdRpush));
         $this->assertSame(3, $connection->executeCommand($cmdRpush));

+ 1 - 1
tests/Predis/Connection/WebdisConnectionTest.php

@@ -129,7 +129,7 @@ class WebdisConnectionTest extends PredisTestCase
         $cmdRpush  = $profile->createCommand('rpush', array('metavars', 'foo', 'hoge', 'lol'));
         $cmdRpush  = $profile->createCommand('rpush', array('metavars', 'foo', 'hoge', 'lol'));
         $cmdLrange = $profile->createCommand('lrange', array('metavars', 0, -1));
         $cmdLrange = $profile->createCommand('lrange', array('metavars', 0, -1));
 
 
-        $this->assertSame('PONG', $connection->executeCommand($cmdPing));
+        $this->assertEquals('PONG', $connection->executeCommand($cmdPing));
         $this->assertSame('echoed', $connection->executeCommand($cmdEcho));
         $this->assertSame('echoed', $connection->executeCommand($cmdEcho));
         $this->assertNull($connection->executeCommand($cmdGet));
         $this->assertNull($connection->executeCommand($cmdGet));
         $this->assertSame(3, $connection->executeCommand($cmdRpush));
         $this->assertSame(3, $connection->executeCommand($cmdRpush));

+ 1 - 1
tests/Predis/Monitor/ConsumerTest.php

@@ -192,6 +192,6 @@ class ConsumerTest extends PredisTestCase
 
 
         $this->assertSame(array('message1', 'message2', 'QUIT'), $echoed);
         $this->assertSame(array('message1', 'message2', 'QUIT'), $echoed);
         $this->assertFalse($monitor->valid());
         $this->assertFalse($monitor->valid());
-        $this->assertTrue($consumer->ping());
+        $this->assertEquals('PONG', $consumer->ping());
     }
     }
 }
 }

+ 9 - 7
tests/Predis/Pipeline/AtomicTest.php

@@ -26,12 +26,13 @@ class AtomicTest extends PredisTestCase
      */
      */
     public function testPipelineWithSingleConnection()
     public function testPipelineWithSingleConnection()
     {
     {
-        $queued = new Response\StatusQueued();
+        $pong = new Response\Status('PONG');
+        $queued = new Response\Status('QUEUED');
 
 
         $connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
         $connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
         $connection->expects($this->exactly(2))
         $connection->expects($this->exactly(2))
                    ->method('executeCommand')
                    ->method('executeCommand')
-                   ->will($this->onConsecutiveCalls(true, array('PONG', 'PONG', 'PONG')));
+                   ->will($this->onConsecutiveCalls(true, array($pong, $pong, $pong)));
         $connection->expects($this->exactly(3))
         $connection->expects($this->exactly(3))
                    ->method('writeRequest');
                    ->method('writeRequest');
         $connection->expects($this->at(3))
         $connection->expects($this->at(3))
@@ -44,7 +45,7 @@ class AtomicTest extends PredisTestCase
         $pipeline->ping();
         $pipeline->ping();
         $pipeline->ping();
         $pipeline->ping();
 
 
-        $this->assertSame(array(true, true, true), $pipeline->execute());
+        $this->assertSame(array($pong, $pong, $pong), $pipeline->execute());
     }
     }
 
 
     /**
     /**
@@ -75,7 +76,7 @@ class AtomicTest extends PredisTestCase
      */
      */
     public function testPipelineWithErrorInTransaction()
     public function testPipelineWithErrorInTransaction()
     {
     {
-        $queued = new Response\StatusQueued();
+        $queued = new Response\Status('QUEUED');
         $error = new Response\Error('ERR Test error');
         $error = new Response\Error('ERR Test error');
 
 
         $connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
         $connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
@@ -125,7 +126,8 @@ class AtomicTest extends PredisTestCase
      */
      */
     public function testReturnsResponseErrorWithClientExceptionsSetToFalse()
     public function testReturnsResponseErrorWithClientExceptionsSetToFalse()
     {
     {
-        $queued = new Response\StatusQueued();
+        $pong = new Response\Status('PONG');
+        $queued = new Response\Status('QUEUED');
         $error = new Response\Error('ERR Test error');
         $error = new Response\Error('ERR Test error');
 
 
         $connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
         $connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
@@ -134,7 +136,7 @@ class AtomicTest extends PredisTestCase
                    ->will($this->onConsecutiveCalls($queued, $queued, $queued));
                    ->will($this->onConsecutiveCalls($queued, $queued, $queued));
         $connection->expects($this->at(7))
         $connection->expects($this->at(7))
                    ->method('executeCommand')
                    ->method('executeCommand')
-                   ->will($this->returnValue(array('PONG', 'PONG', $error)));
+                   ->will($this->returnValue(array($pong, $pong, $error)));
 
 
         $pipeline = new Atomic(new Client($connection, array('exceptions' => false)));
         $pipeline = new Atomic(new Client($connection, array('exceptions' => false)));
 
 
@@ -142,7 +144,7 @@ class AtomicTest extends PredisTestCase
         $pipeline->ping();
         $pipeline->ping();
         $pipeline->ping();
         $pipeline->ping();
 
 
-        $this->assertSame(array(true, true, $error), $pipeline->execute());
+        $this->assertSame(array($pong, $pong, $error), $pipeline->execute());
     }
     }
 
 
     /**
     /**

+ 7 - 5
tests/Predis/Pipeline/PipelineTest.php

@@ -228,6 +228,8 @@ class PipelineTest extends PredisTestCase
      */
      */
     public function testSwitchesToMasterWithReplicationConnection()
     public function testSwitchesToMasterWithReplicationConnection()
     {
     {
+        $pong = new Response\Status('PONG');
+
         $connection = $this->getMock('Predis\Connection\ReplicationConnectionInterface');
         $connection = $this->getMock('Predis\Connection\ReplicationConnectionInterface');
         $connection->expects($this->once())
         $connection->expects($this->once())
                    ->method('switchTo')
                    ->method('switchTo')
@@ -236,7 +238,7 @@ class PipelineTest extends PredisTestCase
                    ->method('writeRequest');
                    ->method('writeRequest');
         $connection->expects($this->exactly(3))
         $connection->expects($this->exactly(3))
                    ->method('readResponse')
                    ->method('readResponse')
-                   ->will($this->returnValue('PONG'));
+                   ->will($this->returnValue($pong));
 
 
         $pipeline = new Pipeline(new Client($connection));
         $pipeline = new Pipeline(new Client($connection));
 
 
@@ -244,7 +246,7 @@ class PipelineTest extends PredisTestCase
         $pipeline->ping();
         $pipeline->ping();
         $pipeline->ping();
         $pipeline->ping();
 
 
-        $this->assertSame(array(true, true, true), $pipeline->execute());
+        $this->assertSame(array($pong, $pong, $pong), $pipeline->execute());
     }
     }
 
 
     /**
     /**
@@ -372,7 +374,7 @@ class PipelineTest extends PredisTestCase
             $pipe->get('foo');
             $pipe->get('foo');
         });
         });
 
 
-        $this->assertSame(array(true, 'bar'), $results);
+        $this->assertEquals(array('OK', 'bar'), $results);
         $this->assertTrue($client->exists('foo'));
         $this->assertTrue($client->exists('foo'));
     }
     }
 
 
@@ -390,7 +392,7 @@ class PipelineTest extends PredisTestCase
             $pipe->get('foo');
             $pipe->get('foo');
         });
         });
 
 
-        $this->assertSame(array(true, 'bar'), $results);
+        $this->assertEquals(array('OK', 'bar'), $results);
         $this->assertSame('oob message', $oob);
         $this->assertSame('oob message', $oob);
         $this->assertTrue($client->exists('foo'));
         $this->assertTrue($client->exists('foo'));
     }
     }
@@ -453,7 +455,7 @@ class PipelineTest extends PredisTestCase
             $pipe->get('foo');
             $pipe->get('foo');
         });
         });
 
 
-        $this->assertTrue($results[0]);
+        $this->assertEquals('OK', $results[0]);
         $this->assertInstanceOf('Predis\Response\Error', $results[1]);
         $this->assertInstanceOf('Predis\Response\Error', $results[1]);
         $this->assertSame('bar', $results[2]);
         $this->assertSame('bar', $results[2]);
     }
     }

+ 12 - 3
tests/Predis/Protocol/Text/Handler/StatusResponseTest.php

@@ -30,7 +30,10 @@ class StatusResponseTest extends PredisTestCase
         $connection->expects($this->never())->method('readLine');
         $connection->expects($this->never())->method('readLine');
         $connection->expects($this->never())->method('readBytes');
         $connection->expects($this->never())->method('readBytes');
 
 
-        $this->assertTrue($handler->handle($connection, 'OK'));
+        $response = $handler->handle($connection, 'OK');
+
+        $this->assertInstanceOf('Predis\Response\Status', $response);
+        $this->assertEquals('OK', $response);
     }
     }
 
 
     /**
     /**
@@ -45,7 +48,10 @@ class StatusResponseTest extends PredisTestCase
         $connection->expects($this->never())->method('readLine');
         $connection->expects($this->never())->method('readLine');
         $connection->expects($this->never())->method('readBytes');
         $connection->expects($this->never())->method('readBytes');
 
 
-        $this->assertInstanceOf('Predis\Response\StatusQueued', $handler->handle($connection, 'QUEUED'));
+        $response = $handler->handle($connection, 'QUEUED');
+
+        $this->assertInstanceOf('Predis\Response\Status', $response);
+        $this->assertEquals('QUEUED', $response);
     }
     }
 
 
     /**
     /**
@@ -60,6 +66,9 @@ class StatusResponseTest extends PredisTestCase
         $connection->expects($this->never())->method('readLine');
         $connection->expects($this->never())->method('readLine');
         $connection->expects($this->never())->method('readBytes');
         $connection->expects($this->never())->method('readBytes');
 
 
-        $this->assertSame('Background saving started', $handler->handle($connection, 'Background saving started'));
+        $response = $handler->handle($connection, 'Background saving started');
+
+        $this->assertInstanceOf('Predis\Response\Status', $response);
+        $this->assertEquals('Background saving started', $response);
     }
     }
 }
 }

+ 1 - 1
tests/Predis/Protocol/Text/ProtocolProcessorTest.php

@@ -76,7 +76,7 @@ class ProtocolProcessorTest extends PredisTestCase
                    ->method('readLine')
                    ->method('readLine')
                    ->will($this->returnValue("*-1"));
                    ->will($this->returnValue("*-1"));
 
 
-        $this->assertTrue($protocol->read($connection));
+        $this->assertEquals('OK', $protocol->read($connection));
         $this->assertEquals("ERR error message", $protocol->read($connection));
         $this->assertEquals("ERR error message", $protocol->read($connection));
         $this->assertSame(2, $protocol->read($connection));
         $this->assertSame(2, $protocol->read($connection));
         $this->assertNull($protocol->read($connection));
         $this->assertNull($protocol->read($connection));

+ 2 - 2
tests/Predis/Protocol/Text/ResponseReaderTest.php

@@ -79,8 +79,8 @@ class ResponseReaderTest extends PredisTestCase
                    ->method('readLine')
                    ->method('readLine')
                    ->will($this->returnValue("*-1"));
                    ->will($this->returnValue("*-1"));
 
 
-        $this->assertTrue($reader->read($connection));
-        $this->assertEquals("ERR error message", $reader->read($connection));
+        $this->assertEquals('OK', $reader->read($connection));
+        $this->assertEquals('ERR error message', $reader->read($connection));
         $this->assertSame(2, $reader->read($connection));
         $this->assertSame(2, $reader->read($connection));
         $this->assertNull($reader->read($connection));
         $this->assertNull($reader->read($connection));
         $this->assertNull($reader->read($connection));
         $this->assertNull($reader->read($connection));

+ 1 - 1
tests/Predis/PubSub/ConsumerTest.php

@@ -303,6 +303,6 @@ class ConsumerTest extends PredisTestCase
 
 
         $this->assertSame(array('message1', 'message2', 'QUIT'), $messages);
         $this->assertSame(array('message1', 'message2', 'QUIT'), $messages);
         $this->assertFalse($pubsub->valid());
         $this->assertFalse($pubsub->valid());
-        $this->assertTrue($consumer->ping());
+        $this->assertEquals('PONG', $consumer->ping());
     }
     }
 }
 }

+ 2 - 2
tests/Predis/PubSub/DispatcherLoopTest.php

@@ -78,7 +78,7 @@ class DispatcherLoopTest extends PredisTestCase
 
 
         $dispatcher->run();
         $dispatcher->run();
 
 
-        $this->assertTrue($consumer->ping());
+        $this->assertEquals('PONG', $consumer->ping());
     }
     }
 
 
     /**
     /**
@@ -120,6 +120,6 @@ class DispatcherLoopTest extends PredisTestCase
 
 
         $dispatcher->run();
         $dispatcher->run();
 
 
-        $this->assertTrue($consumer->ping());
+        $this->assertEquals('PONG', $consumer->ping());
     }
     }
 }
 }

+ 4 - 4
tests/Predis/Response/Iterator/MultiBulkTest.php

@@ -47,7 +47,7 @@ class MultiBulkTest extends PredisTestCase
         $this->assertSame(3, $iterator->next());
         $this->assertSame(3, $iterator->next());
         $this->assertFalse($iterator->valid());
         $this->assertFalse($iterator->valid());
 
 
-        $this->assertTrue($client->ping());
+        $this->assertEquals('PONG', $client->ping());
     }
     }
 
 
     /**
     /**
@@ -74,7 +74,7 @@ class MultiBulkTest extends PredisTestCase
         $iterator->drop(false);
         $iterator->drop(false);
 
 
         $this->assertTrue($client->isConnected());
         $this->assertTrue($client->isConnected());
-        $this->assertTrue($client->ping());
+        $this->assertEquals('PONG', $client->ping());
     }
     }
 
 
     /**
     /**
@@ -89,7 +89,7 @@ class MultiBulkTest extends PredisTestCase
         $iterator->drop(true);
         $iterator->drop(true);
 
 
         $this->assertFalse($client->isConnected());
         $this->assertFalse($client->isConnected());
-        $this->assertTrue($client->ping());
+        $this->assertEquals('PONG', $client->ping());
     }
     }
 
 
     /**
     /**
@@ -105,7 +105,7 @@ class MultiBulkTest extends PredisTestCase
         unset($iterator);
         unset($iterator);
 
 
         $this->assertFalse($client->isConnected());
         $this->assertFalse($client->isConnected());
-        $this->assertTrue($client->ping());
+        $this->assertEquals('PONG', $client->ping());
     }
     }
 
 
     // ******************************************************************** //
     // ******************************************************************** //

+ 2 - 2
tests/Predis/Response/Iterator/MultiBulkTupleTest.php

@@ -75,7 +75,7 @@ class MultiBulkTupleTest extends PredisTestCase
         $this->assertSame(3, $iterator->next());
         $this->assertSame(3, $iterator->next());
         $this->assertFalse($iterator->valid());
         $this->assertFalse($iterator->valid());
 
 
-        $this->assertTrue($client->ping());
+        $this->assertEquals('PONG', $client->ping());
     }
     }
 
 
     /**
     /**
@@ -91,7 +91,7 @@ class MultiBulkTupleTest extends PredisTestCase
         unset($iterator);
         unset($iterator);
 
 
         $this->assertFalse($client->isConnected());
         $this->assertFalse($client->isConnected());
-        $this->assertTrue($client->ping());
+        $this->assertEquals('PONG', $client->ping());
     }
     }
 
 
     // ******************************************************************** //
     // ******************************************************************** //

+ 0 - 51
tests/Predis/Response/StatusQueuedTest.php

@@ -1,51 +0,0 @@
-<?php
-
-/*
- * This file is part of the Predis package.
- *
- * (c) Daniele Alessandri <suppakilla@gmail.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Predis\Response;
-
-use PredisTestCase;
-
-/**
- *
- */
-class StatusQueuedTest extends PredisTestCase
-{
-    /**
-     * @group disconnected
-     */
-    public function testResponseQueuedClass()
-    {
-        $queued = new StatusQueued();
-
-        $this->assertInstanceOf('Predis\Response\ObjectInterface', $queued);
-    }
-
-    /**
-     * @group disconnected
-     */
-    public function testToString()
-    {
-        $queued = new StatusQueued();
-
-        $this->assertEquals('QUEUED', (string) $queued);
-    }
-
-    /**
-     * @group disconnected
-     */
-    public function testQueuedProperty()
-    {
-        $queued = new StatusQueued();
-
-        $this->assertTrue(isset($queued->queued));
-        $this->assertTrue($queued->queued);
-    }
-}

+ 57 - 0
tests/Predis/Response/StatusTest.php

@@ -0,0 +1,57 @@
+<?php
+
+/*
+ * This file is part of the Predis package.
+ *
+ * (c) Daniele Alessandri <suppakilla@gmail.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Predis\Response;
+
+use PredisTestCase;
+
+/**
+ *
+ */
+class StatusTest extends PredisTestCase
+{
+    /**
+     * @group disconnected
+     */
+    public function testStatusResponse()
+    {
+        $status = new Status('OK');
+
+        $this->assertInstanceOf('Predis\Response\ObjectInterface', $status);
+        $this->assertSame('OK', $status->getPayload());
+    }
+
+    /**
+     * @group disconnected
+     */
+    public function testStatusToString()
+    {
+        $queued = new Status('OK');
+
+        $this->assertSame('OK', (string) $queued);
+        $this->assertEquals('OK', $queued);
+    }
+
+    /**
+     * @group disconnected
+     */
+    public function testStaticGetMethod()
+    {
+        $this->assertInstanceOf('Predis\Response\Status', $response = Status::get('OK'));
+        $this->assertEquals('OK', $response);
+
+        $this->assertInstanceOf('Predis\Response\Status', $response = Status::get('QUEUED'));
+        $this->assertEquals('QUEUED', $response);
+
+        $this->assertInstanceOf('Predis\Response\Status', $response = Status::get('PONG'));
+        $this->assertEquals('PONG', $response);
+    }
+}

+ 7 - 7
tests/Predis/Transaction/MultiExecTest.php

@@ -498,7 +498,7 @@ class MultiExecTest extends PredisTestCase
                     return $expected;
                     return $expected;
 
 
                 default:
                 default:
-                    return new Response\StatusQueued();
+                    return new Response\Status('QUEUED');
             }
             }
         });
         });
 
 
@@ -532,7 +532,7 @@ class MultiExecTest extends PredisTestCase
                     return $expected;
                     return $expected;
 
 
                 default:
                 default:
-                    return new Response\StatusQueued();
+                    return new Response\Status('QUEUED');
             }
             }
         });
         });
 
 
@@ -558,7 +558,7 @@ class MultiExecTest extends PredisTestCase
                     return new Response\Error('ERR simulated failure on EXEC');
                     return new Response\Error('ERR simulated failure on EXEC');
 
 
                 default:
                 default:
-                    return new Response\StatusQueued();
+                    return new Response\Status('QUEUED');
             }
             }
         });
         });
 
 
@@ -629,8 +629,8 @@ class MultiExecTest extends PredisTestCase
             $tx->echo('foobar');
             $tx->echo('foobar');
         });
         });
 
 
-        $this->assertTrue($replies[0]);
-        $this->assertInstanceOf('Predis\Response\ErrorInterface', $replies[1]);
+        $this->assertInstanceOf('Predis\Response\Status', $replies[0]);
+        $this->assertInstanceOf('Predis\Response\Error', $replies[1]);
         $this->assertSame('foobar', $replies[2]);
         $this->assertSame('foobar', $replies[2]);
     }
     }
 
 
@@ -829,13 +829,13 @@ class MultiExecTest extends PredisTestCase
                         $abort = true;
                         $abort = true;
                     }
                     }
 
 
-                    return new Response\StatusQueued();
+                    return new Response\Status('QUEUED');
 
 
                 case 'UNWATCH':
                 case 'UNWATCH':
                     $watch = false;
                     $watch = false;
 
 
                 default:
                 default:
-                    return $multi ? new Response\StatusQueued() : 'DUMMY_REPLY';
+                    return $multi ? new Response\Status('QUEUED') : 'DUMMY_REPLY';
             }
             }
         };
         };
     }
     }