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:
Pascal CESCON
2026-10-07 10:42:14 +02:00
committed by GitHub
parent f3020d15cc
commit 29540e37a9
6 changed files with 61 additions and 4 deletions
@@ -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
*/