diff --git a/CHANGELOG.md b/CHANGELOG.md index a0e98a32..c14d7ee5 100644 --- a/CHANGELOG.md +++ b/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. diff --git a/examples/SimpleDebuggableConnection.php b/examples/SimpleDebuggableConnection.php index b265a627..86c6e379 100644 --- a/examples/SimpleDebuggableConnection.php +++ b/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, '->'); } diff --git a/lib/Predis/Connection/AbstractConnection.php b/lib/Predis/Connection/AbstractConnection.php index 37df65a8..f857be7e 100644 --- a/lib/Predis/Connection/AbstractConnection.php +++ b/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); } diff --git a/lib/Predis/Connection/ComposableStreamConnection.php b/lib/Predis/Connection/ComposableStreamConnection.php index 1b109a99..1bbcaada 100644 --- a/lib/Predis/Connection/ComposableStreamConnection.php +++ b/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); } diff --git a/lib/Predis/Connection/ConnectionInterface.php b/lib/Predis/Connection/ConnectionInterface.php index b30de09f..3ae5f5d0 100644 --- a/lib/Predis/Connection/ConnectionInterface.php +++ b/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. diff --git a/lib/Predis/Connection/MasterSlaveReplication.php b/lib/Predis/Connection/MasterSlaveReplication.php index 91c8de46..804ffc6f 100644 --- a/lib/Predis/Connection/MasterSlaveReplication.php +++ b/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); } /** diff --git a/lib/Predis/Connection/PhpiredisConnection.php b/lib/Predis/Connection/PhpiredisConnection.php index 0b0c44a2..a9799235 100644 --- a/lib/Predis/Connection/PhpiredisConnection.php +++ b/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()); diff --git a/lib/Predis/Connection/PhpiredisStreamConnection.php b/lib/Predis/Connection/PhpiredisStreamConnection.php index 082fd0b2..a6c9c9b1 100644 --- a/lib/Predis/Connection/PhpiredisStreamConnection.php +++ b/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()); diff --git a/lib/Predis/Connection/PredisCluster.php b/lib/Predis/Connection/PredisCluster.php index b6dd5a22..aeefb29f 100644 --- a/lib/Predis/Connection/PredisCluster.php +++ b/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); } /** diff --git a/lib/Predis/Connection/RedisCluster.php b/lib/Predis/Connection/RedisCluster.php index ff261af6..5cef6316 100644 --- a/lib/Predis/Connection/RedisCluster.php +++ b/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); } /** diff --git a/lib/Predis/Connection/StreamConnection.php b/lib/Predis/Connection/StreamConnection.php index ab078ae9..3603515b 100644 --- a/lib/Predis/Connection/StreamConnection.php +++ b/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(); diff --git a/lib/Predis/Connection/WebdisConnection.php b/lib/Predis/Connection/WebdisConnection.php index ea02b37d..35d3ca45 100644 --- a/lib/Predis/Connection/WebdisConnection.php +++ b/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__); } diff --git a/lib/Predis/Pipeline/Atomic.php b/lib/Predis/Pipeline/Atomic.php index 09f54d06..b28169aa 100644 --- a/lib/Predis/Pipeline/Atomic.php +++ b/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) { diff --git a/lib/Predis/Pipeline/ConnectionErrorProof.php b/lib/Predis/Pipeline/ConnectionErrorProof.php index 6fd70dea..f593d91b 100644 --- a/lib/Predis/Pipeline/ConnectionErrorProof.php +++ b/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; } diff --git a/lib/Predis/Pipeline/FireAndForget.php b/lib/Predis/Pipeline/FireAndForget.php index ed6f7d81..b4e563e1 100644 --- a/lib/Predis/Pipeline/FireAndForget.php +++ b/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(); diff --git a/lib/Predis/Pipeline/Pipeline.php b/lib/Predis/Pipeline/Pipeline.php index f29397d7..51add7d7 100644 --- a/lib/Predis/Pipeline/Pipeline.php +++ b/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(); diff --git a/lib/Predis/PubSub/AbstractConsumer.php b/lib/Predis/PubSub/AbstractConsumer.php index 2cdd7f03..439ece40 100644 --- a/lib/Predis/PubSub/AbstractConsumer.php +++ b/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} diff --git a/lib/Predis/PubSub/Consumer.php b/lib/Predis/PubSub/Consumer.php index a083a1fd..a0a83497 100644 --- a/lib/Predis/PubSub/Consumer.php +++ b/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); } /** diff --git a/tests/PHPUnit/PredisConnectionTestCase.php b/tests/PHPUnit/PredisConnectionTestCase.php index ff12f03c..41b40a44 100644 --- a/tests/PHPUnit/PredisConnectionTestCase.php +++ b/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()); } diff --git a/tests/Predis/Connection/ComposableStreamConnectionTest.php b/tests/Predis/Connection/ComposableStreamConnectionTest.php index 20a48451..c9f36997 100644 --- a/tests/Predis/Connection/ComposableStreamConnectionTest.php +++ b/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(); diff --git a/tests/Predis/Connection/MasterSlaveReplicationTest.php b/tests/Predis/Connection/MasterSlaveReplicationTest.php index d6f407f3..90c57e8c 100644 --- a/tests/Predis/Connection/MasterSlaveReplicationTest.php +++ b/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); } /** diff --git a/tests/Predis/Connection/PhpiredisConnectionTest.php b/tests/Predis/Connection/PhpiredisConnectionTest.php index d6341846..a34424a4 100644 --- a/tests/Predis/Connection/PhpiredisConnectionTest.php +++ b/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(); diff --git a/tests/Predis/Connection/PhpiredisStreamConnectionTest.php b/tests/Predis/Connection/PhpiredisStreamConnectionTest.php index e6ff550d..f68673d9 100644 --- a/tests/Predis/Connection/PhpiredisStreamConnectionTest.php +++ b/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(); diff --git a/tests/Predis/Connection/PredisClusterTest.php b/tests/Predis/Connection/PredisClusterTest.php index bc834c9c..ba184a7e 100644 --- a/tests/Predis/Connection/PredisClusterTest.php +++ b/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); } /** diff --git a/tests/Predis/Connection/RedisClusterTest.php b/tests/Predis/Connection/RedisClusterTest.php index 52c9ef4c..706ba6e4 100644 --- a/tests/Predis/Connection/RedisClusterTest.php +++ b/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); } /** diff --git a/tests/Predis/Connection/StreamConnectionTest.php b/tests/Predis/Connection/StreamConnectionTest.php index b8f97535..abb86378 100644 --- a/tests/Predis/Connection/StreamConnectionTest.php +++ b/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(); diff --git a/tests/Predis/Connection/WebdisConnectionTest.php b/tests/Predis/Connection/WebdisConnectionTest.php index 729a07f4..64c67c72 100644 --- a/tests/Predis/Connection/WebdisConnectionTest.php +++ b/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')); } /** diff --git a/tests/Predis/Pipeline/AtomicTest.php b/tests/Predis/Pipeline/AtomicTest.php index 6453bae9..b6528ee2 100644 --- a/tests/Predis/Pipeline/AtomicTest.php +++ b/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)); diff --git a/tests/Predis/Pipeline/FireAndForgetTest.php b/tests/Predis/Pipeline/FireAndForgetTest.php index ad378be0..e65895ae 100644 --- a/tests/Predis/Pipeline/FireAndForgetTest.php +++ b/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'); diff --git a/tests/Predis/Pipeline/PipelineTest.php b/tests/Predis/Pipeline/PipelineTest.php index c0a844c9..8032b4da 100644 --- a/tests/Predis/Pipeline/PipelineTest.php +++ b/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)); diff --git a/tests/Predis/PubSub/ConsumerTest.php b/tests/Predis/PubSub/ConsumerTest.php index 1a8bf0a5..9490b145 100644 --- a/tests/Predis/PubSub/ConsumerTest.php +++ b/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) diff --git a/tests/Predis/Replication/ReplicationStrategyTest.php b/tests/Predis/Replication/ReplicationStrategyTest.php index 914ffd7c..45bfc03b 100644 --- a/tests/Predis/Replication/ReplicationStrategyTest.php +++ b/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();