mirror of
https://github.com/predis/predis.git
synced 2026-09-15 12:57:10 +00:00
Make Pipeline::executeCommand() return $this for fluent interface.
Backported from 3befbb3 (master).
This commit is contained in:
@@ -90,11 +90,14 @@ class PipelineContext implements BasicClientInterface, ExecutableContextInterfac
|
||||
/**
|
||||
* Queues a command instance into the pipeline buffer.
|
||||
*
|
||||
* @param CommandInterface $command Command to queue in the buffer.
|
||||
* @param CommandInterface $command Command to queue in the buffer.
|
||||
* @return $this
|
||||
*/
|
||||
public function executeCommand(CommandInterface $command)
|
||||
{
|
||||
$this->recordCommand($command);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -74,6 +74,20 @@ class PipelineContextTest extends PredisTestCase
|
||||
$this->assertSame($pipeline, $pipeline->echo('one')->echo('two')->echo('three'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
public function testExecuteReturnsPipelineForFluentInterface()
|
||||
{
|
||||
$profile = ServerProfile::getDefault();
|
||||
$connection = $this->getMock('Predis\Connection\SingleConnectionInterface');
|
||||
|
||||
$pipeline = new PipelineContext(new Client($connection));
|
||||
$command = $profile->createCommand('echo', array('one'));
|
||||
|
||||
$this->assertSame($pipeline, $pipeline->executeCommand($command));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user