Browse Source

Rename ConnectionInterface::writeCommand() to writeRequest().

This name is more consistent with its counterpart, readResponse().
Daniele Alessandri 11 năm trước cách đây
mục cha
commit
4bf0ee4c6a
32 tập tin đã thay đổi với 80 bổ sung76 xóa
  1. 4 0
      CHANGELOG.md
  2. 2 2
      examples/SimpleDebuggableConnection.php
  3. 1 1
      lib/Predis/Connection/AbstractConnection.php
  4. 1 1
      lib/Predis/Connection/ComposableStreamConnection.php
  5. 1 1
      lib/Predis/Connection/ConnectionInterface.php
  6. 2 2
      lib/Predis/Connection/MasterSlaveReplication.php
  7. 1 1
      lib/Predis/Connection/PhpiredisConnection.php
  8. 1 1
      lib/Predis/Connection/PhpiredisStreamConnection.php
  9. 2 2
      lib/Predis/Connection/PredisCluster.php
  10. 2 2
      lib/Predis/Connection/RedisCluster.php
  11. 1 1
      lib/Predis/Connection/StreamConnection.php
  12. 1 1
      lib/Predis/Connection/WebdisConnection.php
  13. 1 1
      lib/Predis/Pipeline/Atomic.php
  14. 2 2
      lib/Predis/Pipeline/ConnectionErrorProof.php
  15. 1 1
      lib/Predis/Pipeline/FireAndForget.php
  16. 1 1
      lib/Predis/Pipeline/Pipeline.php
  17. 5 5
      lib/Predis/PubSub/AbstractConsumer.php
  18. 2 2
      lib/Predis/PubSub/Consumer.php
  19. 13 13
      tests/PHPUnit/PredisConnectionTestCase.php
  20. 2 2
      tests/Predis/Connection/ComposableStreamConnectionTest.php
  21. 6 6
      tests/Predis/Connection/MasterSlaveReplicationTest.php
  22. 1 1
      tests/Predis/Connection/PhpiredisConnectionTest.php
  23. 1 1
      tests/Predis/Connection/PhpiredisStreamConnectionTest.php
  24. 3 3
      tests/Predis/Connection/PredisClusterTest.php
  25. 3 3
      tests/Predis/Connection/RedisClusterTest.php
  26. 1 1
      tests/Predis/Connection/StreamConnectionTest.php
  27. 2 2
      tests/Predis/Connection/WebdisConnectionTest.php
  28. 1 1
      tests/Predis/Pipeline/AtomicTest.php
  29. 2 2
      tests/Predis/Pipeline/FireAndForgetTest.php
  30. 9 9
      tests/Predis/Pipeline/PipelineTest.php
  31. 4 4
      tests/Predis/PubSub/ConsumerTest.php
  32. 1 1
      tests/Predis/Replication/ReplicationStrategyTest.php

+ 4 - 0
CHANGELOG.md

@@ -41,6 +41,10 @@ v0.9.0 (201x-xx-xx)
     - `Predis\Command\AbstractCommand` is now `Predis\Command\Command`
     - `Predis\Command\ScriptedCommand` is now `Predis\Command\ScriptCommand`
 
+- The method `Predis\Connection\ConnectionInterface::writeCommand()` has been
+  renamed to `writeRequest()` for consistency with its counterpart, the method
+  `readResponse()`.
+
 - Most classes and interfaces in the `Predis\Protocol` namespace have been moved
   or renamed while rationalizing the whole API of external protocol processors.
 

+ 2 - 2
examples/SimpleDebuggableConnection.php

@@ -36,8 +36,8 @@ class SimpleDebuggableConnection extends StreamConnection {
         $this->debugBuffer[] = $debug;
     }
 
-    public function writeCommand(CommandInterface $command) {
-        parent::writeCommand($command);
+    public function writeRequest(CommandInterface $command) {
+        parent::writeRequest($command);
 
         $this->storeDebug($command, '->');
     }

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

@@ -116,7 +116,7 @@ abstract class AbstractConnection implements SingleConnectionInterface
      */
     public function executeCommand(CommandInterface $command)
     {
-        $this->writeCommand($command);
+        $this->writeRequest($command);
         return $this->readResponse($command);
     }
 

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

@@ -102,7 +102,7 @@ class ComposableStreamConnection extends StreamConnection implements ComposableC
     /**
      * {@inheritdoc}
      */
-    public function writeCommand(CommandInterface $command)
+    public function writeRequest(CommandInterface $command)
     {
         $this->protocol->write($this, $command);
     }

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

@@ -43,7 +43,7 @@ interface ConnectionInterface
      *
      * @param CommandInterface $command Instance of a Redis command.
      */
-    public function writeCommand(CommandInterface $command);
+    public function writeRequest(CommandInterface $command);
 
     /**
      * Reads the reply for a Redis command from the connection.

+ 2 - 2
lib/Predis/Connection/MasterSlaveReplication.php

@@ -230,9 +230,9 @@ class MasterSlaveReplication implements ReplicationConnectionInterface
     /**
      * {@inheritdoc}
      */
-    public function writeCommand(CommandInterface $command)
+    public function writeRequest(CommandInterface $command)
     {
-        $this->getConnection($command)->writeCommand($command);
+        $this->getConnection($command)->writeRequest($command);
     }
 
     /**

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

@@ -375,7 +375,7 @@ class PhpiredisConnection extends AbstractConnection
     /**
      * {@inheritdoc}
      */
-    public function writeCommand(CommandInterface $command)
+    public function writeRequest(CommandInterface $command)
     {
         $arguments = $command->getArguments();
         array_unshift($arguments, $command->getId());

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

@@ -171,7 +171,7 @@ class PhpiredisStreamConnection extends StreamConnection
     /**
      * {@inheritdoc}
      */
-    public function writeCommand(CommandInterface $command)
+    public function writeRequest(CommandInterface $command)
     {
         $arguments = $command->getArguments();
         array_unshift($arguments, $command->getId());

+ 2 - 2
lib/Predis/Connection/PredisCluster.php

@@ -192,9 +192,9 @@ class PredisCluster implements ClusterConnectionInterface, IteratorAggregate, Co
     /**
      * {@inheritdoc}
      */
-    public function writeCommand(CommandInterface $command)
+    public function writeRequest(CommandInterface $command)
     {
-        $this->getConnection($command)->writeCommand($command);
+        $this->getConnection($command)->writeRequest($command);
     }
 
     /**

+ 2 - 2
lib/Predis/Connection/RedisCluster.php

@@ -352,9 +352,9 @@ class RedisCluster implements ClusterConnectionInterface, \IteratorAggregate, \C
     /**
      * {@inheritdoc}
      */
-    public function writeCommand(CommandInterface $command)
+    public function writeRequest(CommandInterface $command)
     {
-        $this->getConnection($command)->writeCommand($command);
+        $this->getConnection($command)->writeRequest($command);
     }
 
     /**

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

@@ -248,7 +248,7 @@ class StreamConnection extends AbstractConnection
     /**
      * {@inheritdoc}
      */
-    public function writeCommand(CommandInterface $command)
+    public function writeRequest(CommandInterface $command)
     {
         $commandID = $command->getId();
         $arguments = $command->getArguments();

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

@@ -233,7 +233,7 @@ class WebdisConnection implements SingleConnectionInterface
     /**
      * {@inheritdoc}
      */
-    public function writeCommand(CommandInterface $command)
+    public function writeRequest(CommandInterface $command)
     {
         $this->throwNotSupportedException(__FUNCTION__);
     }

+ 1 - 1
lib/Predis/Pipeline/Atomic.php

@@ -67,7 +67,7 @@ class Atomic extends Pipeline
         $connection->executeCommand($profile->createCommand('multi'));
 
         foreach ($commands as $command) {
-            $connection->writeCommand($command);
+            $connection->writeRequest($command);
         }
 
         foreach ($commands as $command) {

+ 2 - 2
lib/Predis/Pipeline/ConnectionErrorProof.php

@@ -59,7 +59,7 @@ class ConnectionErrorProof extends Pipeline
 
         foreach ($commands as $command) {
             try {
-                $connection->writeCommand($command);
+                $connection->writeRequest($command);
             } catch (CommunicationException $exception) {
                 return array_fill(0, $sizeOfPipe, $exception);
             }
@@ -98,7 +98,7 @@ class ConnectionErrorProof extends Pipeline
             }
 
             try {
-                $cmdConnection->writeCommand($command);
+                $cmdConnection->writeRequest($command);
             } catch (CommunicationException $exception) {
                 $exceptions[spl_object_hash($cmdConnection)] = $exception;
             }

+ 1 - 1
lib/Predis/Pipeline/FireAndForget.php

@@ -27,7 +27,7 @@ class FireAndForget extends Pipeline
     protected function executePipeline(ConnectionInterface $connection, SplQueue $commands)
     {
         while (!$commands->isEmpty()) {
-            $connection->writeCommand($commands->dequeue());
+            $connection->writeRequest($commands->dequeue());
         }
 
         $connection->disconnect();

+ 1 - 1
lib/Predis/Pipeline/Pipeline.php

@@ -122,7 +122,7 @@ class Pipeline implements BasicClientInterface, ExecutableContextInterface
     protected function executePipeline(ConnectionInterface $connection, SplQueue $commands)
     {
         foreach ($commands as $command) {
-            $connection->writeCommand($command);
+            $connection->writeRequest($command);
         }
 
         $responses  = array();

+ 5 - 5
lib/Predis/PubSub/AbstractConsumer.php

@@ -60,7 +60,7 @@ abstract class AbstractConsumer implements Iterator
      */
     public function subscribe(/* arguments */)
     {
-        $this->writeCommand(self::SUBSCRIBE, func_get_args());
+        $this->writeRequest(self::SUBSCRIBE, func_get_args());
         $this->statusFlags |= self::STATUS_SUBSCRIBED;
     }
 
@@ -71,7 +71,7 @@ abstract class AbstractConsumer implements Iterator
      */
     public function unsubscribe(/* arguments */)
     {
-        $this->writeCommand(self::UNSUBSCRIBE, func_get_args());
+        $this->writeRequest(self::UNSUBSCRIBE, func_get_args());
     }
 
     /**
@@ -81,7 +81,7 @@ abstract class AbstractConsumer implements Iterator
      */
     public function psubscribe(/* arguments */)
     {
-        $this->writeCommand(self::PSUBSCRIBE, func_get_args());
+        $this->writeRequest(self::PSUBSCRIBE, func_get_args());
         $this->statusFlags |= self::STATUS_PSUBSCRIBED;
     }
 
@@ -92,7 +92,7 @@ abstract class AbstractConsumer implements Iterator
      */
     public function punsubscribe(/* arguments */)
     {
-        $this->writeCommand(self::PUNSUBSCRIBE, func_get_args());
+        $this->writeRequest(self::PUNSUBSCRIBE, func_get_args());
     }
 
     /**
@@ -135,7 +135,7 @@ abstract class AbstractConsumer implements Iterator
      * @param string $method ID of the command.
      * @param array $arguments List of arguments.
      */
-    protected abstract function writeCommand($method, $arguments);
+    protected abstract function writeRequest($method, $arguments);
 
     /**
      * {@inheritdoc}

+ 2 - 2
lib/Predis/PubSub/Consumer.php

@@ -89,11 +89,11 @@ class Consumer extends AbstractConsumer
     /**
      * {@inheritdoc}
      */
-    protected function writeCommand($method, $arguments)
+    protected function writeRequest($method, $arguments)
     {
         $arguments = Command::normalizeArguments($arguments);
         $command = $this->client->createCommand($method, $arguments);
-        $this->client->getConnection()->writeCommand($command);
+        $this->client->getConnection()->writeRequest($command);
     }
 
     /**

+ 13 - 13
tests/PHPUnit/PredisConnectionTestCase.php

@@ -135,7 +135,7 @@ abstract class PredisConnectionTestCase extends PredisTestCase
         $cmdPing->expects($this->never())
                 ->method('parseResponse');
 
-        $connection->writeCommand($cmdPing);
+        $connection->writeRequest($cmdPing);
         $connection->disconnect();
     }
 
@@ -150,7 +150,7 @@ abstract class PredisConnectionTestCase extends PredisTestCase
         $cmdPing->expects($this->never())
                 ->method('parseResponse');
 
-        $connection->writeCommand($cmdPing);
+        $connection->writeRequest($cmdPing);
         $this->assertSame('PONG', $connection->readResponse($cmdPing));
     }
 
@@ -172,8 +172,8 @@ abstract class PredisConnectionTestCase extends PredisTestCase
 
         $connection = $this->getConnection();
 
-        $connection->writeCommand($cmdPing);
-        $connection->writeCommand($cmdEcho);
+        $connection->writeRequest($cmdPing);
+        $connection->writeRequest($cmdEcho);
 
         $this->assertSame('PONG', $connection->readResponse($cmdPing));
         $this->assertSame('ECHOED', $connection->readResponse($cmdEcho));
@@ -209,14 +209,14 @@ abstract class PredisConnectionTestCase extends PredisTestCase
     {
         $connection = $this->getConnection($profile, true);
 
-        $connection->writeCommand($profile->createCommand('set', array('foo', 'bar')));
+        $connection->writeRequest($profile->createCommand('set', array('foo', 'bar')));
         $this->assertTrue($connection->read());
 
-        $connection->writeCommand($profile->createCommand('ping'));
+        $connection->writeRequest($profile->createCommand('ping'));
         $this->assertSame('PONG', $connection->read());
 
-        $connection->writeCommand($profile->createCommand('multi'));
-        $connection->writeCommand($profile->createCommand('ping'));
+        $connection->writeRequest($profile->createCommand('multi'));
+        $connection->writeRequest($profile->createCommand('ping'));
         $this->assertTrue($connection->read());
         $this->assertInstanceOf('Predis\Response\StatusQueued', $connection->read());
     }
@@ -230,10 +230,10 @@ abstract class PredisConnectionTestCase extends PredisTestCase
 
         $connection->executeCommand($profile->createCommand('set', array('foo', 'bar')));
 
-        $connection->writeCommand($profile->createCommand('get', array('foo')));
+        $connection->writeRequest($profile->createCommand('get', array('foo')));
         $this->assertSame('bar', $connection->read());
 
-        $connection->writeCommand($profile->createCommand('get', array('hoge')));
+        $connection->writeRequest($profile->createCommand('get', array('hoge')));
         $this->assertNull($connection->read());
     }
 
@@ -245,7 +245,7 @@ abstract class PredisConnectionTestCase extends PredisTestCase
         $connection = $this->getConnection($profile, true);
 
         $connection->executeCommand($profile->createCommand('rpush', array('metavars', 'foo', 'hoge', 'lol')));
-        $connection->writeCommand($profile->createCommand('llen', array('metavars')));
+        $connection->writeRequest($profile->createCommand('llen', array('metavars')));
 
         $this->assertSame(3, $connection->read());
     }
@@ -258,7 +258,7 @@ abstract class PredisConnectionTestCase extends PredisTestCase
         $connection = $this->getConnection($profile, true);
 
         $connection->executeCommand($profile->createCommand('set', array('foo', 'bar')));
-        $connection->writeCommand($profile->createCommand('rpush', array('foo', 'baz')));
+        $connection->writeRequest($profile->createCommand('rpush', array('foo', 'baz')));
 
         $this->assertInstanceOf('Predis\Response\Error', $error = $connection->read());
         $this->assertRegExp('/[ERR|WRONGTYPE] Operation against a key holding the wrong kind of value/', $error->getMessage());
@@ -272,7 +272,7 @@ abstract class PredisConnectionTestCase extends PredisTestCase
         $connection = $this->getConnection($profile, true);
 
         $connection->executeCommand($profile->createCommand('rpush', array('metavars', 'foo', 'hoge', 'lol')));
-        $connection->writeCommand($profile->createCommand('lrange', array('metavars', 0, -1)));
+        $connection->writeRequest($profile->createCommand('lrange', array('metavars', 0, -1)));
 
         $this->assertSame(array('foo', 'hoge', 'lol'), $connection->read());
     }

+ 2 - 2
tests/Predis/Connection/ComposableStreamConnectionTest.php

@@ -74,7 +74,7 @@ class ComposableStreamConnectionTest extends PredisConnectionTestCase
         $connection->getProtocol()->useIterableMultibulk(true);
 
         $connection->executeCommand($profile->createCommand('rpush', array('metavars', 'foo', 'hoge', 'lol')));
-        $connection->writeCommand($profile->createCommand('lrange', array('metavars', 0, -1)));
+        $connection->writeRequest($profile->createCommand('lrange', array('metavars', 0, -1)));
 
         $this->assertInstanceOf('Predis\Response\Iterator\MultiBulkIterator', $iterator = $connection->read());
         $this->assertSame(array('foo', 'hoge', 'lol'), iterator_to_array($iterator));
@@ -90,7 +90,7 @@ class ComposableStreamConnectionTest extends PredisConnectionTestCase
         $connection = $this->getConnection($profile);
         $stream = $connection->getResource();
 
-        $connection->writeCommand($profile->createCommand('ping'));
+        $connection->writeRequest($profile->createCommand('ping'));
         fread($stream, 1);
 
         $connection->read();

+ 6 - 6
tests/Predis/Connection/MasterSlaveReplicationTest.php

@@ -235,7 +235,7 @@ class MasterSlaveReplicationTest extends PredisTestCase
     /**
      * @group disconnected
      */
-    public function testUsesMasterOnWriteCommands()
+    public function testUsesMasterOnWriteRequests()
     {
         $profile = Profile\Factory::getDefault();
 
@@ -256,7 +256,7 @@ class MasterSlaveReplicationTest extends PredisTestCase
     /**
      * @group disconnected
      */
-    public function testSwitchesFromSlaveToMasterOnWriteCommands()
+    public function testSwitchesFromSlaveToMasterOnWriteRequestss()
     {
         $profile = Profile\Factory::getDefault();
 
@@ -287,17 +287,17 @@ class MasterSlaveReplicationTest extends PredisTestCase
         $cmdSet = $profile->createCommand('set', array('foo', 'bar'));
 
         $master = $this->getMockConnection('tcp://host1?alias=master');
-        $master->expects($this->once())->method('writeCommand')->with($cmdSet);
+        $master->expects($this->once())->method('writeRequest')->with($cmdSet);
 
         $slave1 = $this->getMockConnection('tcp://host2?alias=slave1');
-        $slave1->expects($this->once())->method('writeCommand')->with($cmdExists);
+        $slave1->expects($this->once())->method('writeRequest')->with($cmdExists);
 
         $replication = new MasterSlaveReplication();
         $replication->add($master);
         $replication->add($slave1);
 
-        $replication->writeCommand($cmdExists);
-        $replication->writeCommand($cmdSet);
+        $replication->writeRequest($cmdExists);
+        $replication->writeRequest($cmdSet);
     }
 
     /**

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

@@ -96,7 +96,7 @@ class PhpiredisConnectionTest extends PredisConnectionTestCase
         $connection = $this->getConnection($profile);
         $socket = $connection->getResource();
 
-        $connection->writeCommand($profile->createCommand('ping'));
+        $connection->writeRequest($profile->createCommand('ping'));
         socket_read($socket, 1);
 
         $connection->read();

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

@@ -115,7 +115,7 @@ class PhpiredisStreamConnectionTest extends PredisConnectionTestCase
         $connection = $this->getConnection($profile);
         $socket = $connection->getResource();
 
-        $connection->writeCommand($profile->createCommand('ping'));
+        $connection->writeRequest($profile->createCommand('ping'));
         fread($socket, 1);
 
         $connection->read();

+ 3 - 3
tests/Predis/Connection/PredisClusterTest.php

@@ -276,16 +276,16 @@ class PredisClusterTest extends PredisTestCase
         $command = Profile\Factory::getDefault()->createCommand('get', array('node01:5431'));
 
         $connection1 = $this->getMockConnection('tcp://host1:7001');
-        $connection1->expects($this->once())->method('writeCommand')->with($command);
+        $connection1->expects($this->once())->method('writeRequest')->with($command);
 
         $connection2 = $this->getMockConnection('tcp://host1:7002');
-        $connection2->expects($this->never())->method('writeCommand');
+        $connection2->expects($this->never())->method('writeRequest');
 
         $cluster = new PredisCluster();
         $cluster->add($connection1);
         $cluster->add($connection2);
 
-        $cluster->writeCommand($command);
+        $cluster->writeRequest($command);
     }
 
     /**

+ 3 - 3
tests/Predis/Connection/RedisClusterTest.php

@@ -360,16 +360,16 @@ class RedisClusterTest extends PredisTestCase
         $command = Profile\Factory::getDefault()->createCommand('get', array('node:1001'));
 
         $connection1 = $this->getMockConnection('tcp://127.0.0.1:6379');
-        $connection1->expects($this->once())->method('writeCommand')->with($command);
+        $connection1->expects($this->once())->method('writeRequest')->with($command);
 
         $connection2 = $this->getMockConnection('tcp://127.0.0.1:6380');
-        $connection2->expects($this->never())->method('writeCommand');
+        $connection2->expects($this->never())->method('writeRequest');
 
         $cluster = new RedisCluster();
         $cluster->add($connection1);
         $cluster->add($connection2);
 
-        $cluster->writeCommand($command);
+        $cluster->writeRequest($command);
     }
 
     /**

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

@@ -93,7 +93,7 @@ class StreamConnectionTest extends PredisConnectionTestCase
         $connection = $this->getConnection($profile);
         $stream = $connection->getResource();
 
-        $connection->writeCommand($profile->createCommand('ping'));
+        $connection->writeRequest($profile->createCommand('ping'));
         fread($stream, 1);
 
         $connection->read();

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

@@ -35,12 +35,12 @@ class WebdisConnectionTest extends PredisTestCase
     /**
      * @group disconnected
      * @expectedException Predis\NotSupportedException
-     * @expectedExceptionMessage The method Predis\Connection\WebdisConnection::writeCommand() is not supported
+     * @expectedExceptionMessage The method Predis\Connection\WebdisConnection::writeRequest() is not supported
      */
     public function testWritingCommandsIsNotSupported()
     {
         $connection = new WebdisConnection($this->getParameters());
-        $connection->writeCommand($this->getProfile()->createCommand('ping'));
+        $connection->writeRequest($this->getProfile()->createCommand('ping'));
     }
 
     /**

+ 1 - 1
tests/Predis/Pipeline/AtomicTest.php

@@ -33,7 +33,7 @@ class AtomicTest extends PredisTestCase
                    ->method('executeCommand')
                    ->will($this->onConsecutiveCalls(true, array('PONG', 'PONG', 'PONG')));
         $connection->expects($this->exactly(3))
-                   ->method('writeCommand');
+                   ->method('writeRequest');
         $connection->expects($this->at(3))
                    ->method('readResponse')
                    ->will($this->onConsecutiveCalls($queued, $queued, $queued));

+ 2 - 2
tests/Predis/Pipeline/FireAndForgetTest.php

@@ -29,7 +29,7 @@ class FireAndForgetTest extends PredisTestCase
         $profile = Profile\Factory::getDefault();
 
         $connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
-        $connection->expects($this->exactly(3))->method('writeCommand');
+        $connection->expects($this->exactly(3))->method('writeRequest');
         $connection->expects($this->never())->method('readResponse');
 
         $pipeline = new FireAndForget(new Client($connection));
@@ -53,7 +53,7 @@ class FireAndForgetTest extends PredisTestCase
                    ->method('switchTo')
                    ->with('master');
         $connection->expects($this->exactly(3))
-                   ->method('writeCommand');
+                   ->method('writeRequest');
         $connection->expects($this->never())
                    ->method('readResponse');
 

+ 9 - 9
tests/Predis/Pipeline/PipelineTest.php

@@ -41,7 +41,7 @@ class PipelineTest extends PredisTestCase
     public function testCallDoesNotSendCommandsWithoutExecute()
     {
         $connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
-        $connection->expects($this->never())->method('writeCommand');
+        $connection->expects($this->never())->method('writeRequest');
         $connection->expects($this->never())->method('readResponse');
 
         $pipeline = new Pipeline(new Client($connection));
@@ -57,7 +57,7 @@ class PipelineTest extends PredisTestCase
     public function testCallReturnsPipelineForFluentInterface()
     {
         $connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
-        $connection->expects($this->never())->method('writeCommand');
+        $connection->expects($this->never())->method('writeRequest');
         $connection->expects($this->never())->method('readResponse');
 
         $pipeline = new Pipeline(new Client($connection));
@@ -137,7 +137,7 @@ class PipelineTest extends PredisTestCase
         $profile = Profile\Factory::getDefault();
 
         $connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
-        $connection->expects($this->never())->method('writeCommand');
+        $connection->expects($this->never())->method('writeRequest');
         $connection->expects($this->never())->method('readResponse');
 
         $pipeline = new Pipeline(new Client($connection));
@@ -153,7 +153,7 @@ class PipelineTest extends PredisTestCase
     public function testExecuteWithEmptyBuffer()
     {
         $connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
-        $connection->expects($this->never())->method('writeCommand');
+        $connection->expects($this->never())->method('writeRequest');
         $connection->expects($this->never())->method('readResponse');
 
         $pipeline = new Pipeline(new Client($connection));
@@ -168,7 +168,7 @@ class PipelineTest extends PredisTestCase
     {
         $connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
         $connection->expects($this->exactly(3))
-                   ->method('writeCommand');
+                   ->method('writeRequest');
         $connection->expects($this->exactly(3))
                    ->method('readResponse')
                    ->will($this->returnCallback($this->getReadCallback()));
@@ -207,7 +207,7 @@ class PipelineTest extends PredisTestCase
     {
         $connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
         $connection->expects($this->exactly(4))
-                   ->method('writeCommand');
+                   ->method('writeRequest');
         $connection->expects($this->exactly(4))
                    ->method('readResponse')
                    ->will($this->returnCallback($this->getReadCallback()));
@@ -233,7 +233,7 @@ class PipelineTest extends PredisTestCase
                    ->method('switchTo')
                    ->with('master');
         $connection->expects($this->exactly(3))
-                   ->method('writeCommand');
+                   ->method('writeRequest');
         $connection->expects($this->exactly(3))
                    ->method('readResponse')
                    ->will($this->returnValue('PONG'));
@@ -295,7 +295,7 @@ class PipelineTest extends PredisTestCase
     {
         $connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
         $connection->expects($this->exactly(4))
-                   ->method('writeCommand');
+                   ->method('writeRequest');
         $connection->expects($this->exactly(4))
                    ->method('readResponse')
                    ->will($this->returnCallback($this->getReadCallback()));
@@ -318,7 +318,7 @@ class PipelineTest extends PredisTestCase
     public function testExecuteWithCallableArgumentHandlesExceptions()
     {
         $connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
-        $connection->expects($this->never())->method('writeCommand');
+        $connection->expects($this->never())->method('writeRequest');
         $connection->expects($this->never())->method('readResponse');
 
         $pipeline = new Pipeline(new Client($connection));

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

@@ -74,9 +74,9 @@ class ConsumerTest extends PredisTestCase
         $cmdPsubscribe = $profile->createCommand('psubscribe', array('channels:*'));
 
         $connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
-        $connection->expects($this->exactly(2))->method('writeCommand');
+        $connection->expects($this->exactly(2))->method('writeRequest');
 
-        $client = $this->getMock('Predis\Client', array('createCommand', 'writeCommand'), array($connection));
+        $client = $this->getMock('Predis\Client', array('createCommand', 'writeRequest'), array($connection));
         $client->expects($this->exactly(2))
                ->method('createCommand')
                ->with($this->logicalOr($this->equalTo('subscribe'), $this->equalTo('psubscribe')))
@@ -100,7 +100,7 @@ class ConsumerTest extends PredisTestCase
 
         $pubsub = new PubSubConsumer($client, array('subscribe' => 'channel:foo'));
 
-        $connection->expects($this->never())->method('writeCommand');
+        $connection->expects($this->never())->method('writeRequest');
 
         $pubsub->stop(true);
     }
@@ -122,7 +122,7 @@ class ConsumerTest extends PredisTestCase
         $pubsub = new PubSubConsumer($client, $options);
 
         $connection->expects($this->exactly(2))
-                   ->method('writeCommand')
+                   ->method('writeRequest')
                    ->with($this->logicalOr(
                        $this->isInstanceOf($classUnsubscribe),
                        $this->isInstanceOf($classPunsubscribe)

+ 1 - 1
tests/Predis/Replication/ReplicationStrategyTest.php

@@ -37,7 +37,7 @@ class ReplicationStrategyTest extends PredisTestCase
     /**
      * @group disconnected
      */
-    public function testWriteCommands()
+    public function testWriteRequests()
     {
         $profile = Profile\Factory::getDevelopment();
         $strategy = new ReplicationStrategy();