mirror of
https://github.com/predis/predis.git
synced 2026-08-31 12:43:31 +00:00
Fix small oversight.
Bug was not severe since +QUEUED status responses were returned anyway but they were not cached as expected. We added a test in the suite. This fixes #142.
This commit is contained in:
@@ -69,7 +69,7 @@ class Status implements ResponseInterface
|
||||
|
||||
return self::$OK;
|
||||
|
||||
case 'OK':
|
||||
case 'QUEUED':
|
||||
if (!isset(self::$QUEUED)) {
|
||||
self::$QUEUED = new self('QUEUED');
|
||||
}
|
||||
|
||||
@@ -54,4 +54,19 @@ class StatusTest extends PredisTestCase
|
||||
$this->assertInstanceOf('Predis\Response\Status', $response = Status::get('PONG'));
|
||||
$this->assertEquals('PONG', $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
public function testStaticGetMethodCachesOnlyCommonStatuses()
|
||||
{
|
||||
$response = Status::get('OK');
|
||||
$this->assertSame($response, Status::get('OK'));
|
||||
|
||||
$response = Status::get('QUEUED');
|
||||
$this->assertSame($response, Status::get('QUEUED'));
|
||||
|
||||
$response = Status::get('PONG');
|
||||
$this->assertNotSame($response, Status::get('PONG'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user