mirror of
https://github.com/predis/predis.git
synced 2026-11-11 21:06:06 +00:00
Only wrap known statuses in Status responses on CompositeStreamConnection (#1734)
Since #1293, StreamConnection only returns a Status for OK, QUEUED, NOKEY and PONG. ProtocolProcessor and the StatusResponse handler, used by CompositeStreamConnection, still wrapped every simple string. Fixes #1147 Co-authored-by: Vladyslav Vildanov <117659936+vladvildanov@users.noreply.github.com>
This commit is contained in:
@@ -72,6 +72,26 @@ class ProtocolProcessorTest extends PredisTestCase
|
||||
$this->assertNull($protocol->read($connection));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
public function testReadsOnlyKnownStatusesAsStatusResponses(): void
|
||||
{
|
||||
$protocol = new ProtocolProcessor();
|
||||
|
||||
$connection = $this->getMockConnectionOfType('Predis\Connection\CompositeConnectionInterface');
|
||||
$connection
|
||||
->expects($this->exactly(2))
|
||||
->method('readLine')
|
||||
->willReturnOnConsecutiveCalls(
|
||||
'+OK',
|
||||
'+string'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('Predis\Response\Status', $protocol->read($connection));
|
||||
$this->assertSame('string', $protocol->read($connection));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user