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:
Daniele Alessandri
2013-12-22 10:53:32 +01:00
parent bff7906f68
commit 09f9133df7
2 changed files with 16 additions and 1 deletions
+1 -1
View File
@@ -69,7 +69,7 @@ class Status implements ResponseInterface
return self::$OK;
case 'OK':
case 'QUEUED':
if (!isset(self::$QUEUED)) {
self::$QUEUED = new self('QUEUED');
}
+15
View File
@@ -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'));
}
}