Do not parse response to SETNX into boolean value.

This commit is contained in:
Daniele Alessandri
2015-07-24 15:44:38 +02:00
parent 38fafb22ba
commit 8c76bd6761
2 changed files with 4 additions and 11 deletions
-8
View File
@@ -24,12 +24,4 @@ class StringSetPreserve extends Command
{
return 'SETNX';
}
/**
* {@inheritdoc}
*/
public function parseResponse($data)
{
return (bool) $data;
}
}
@@ -52,7 +52,8 @@ class StringSetPreserveTest extends PredisCommandTestCase
*/
public function testParseResponse()
{
$this->assertTrue($this->getCommand()->parseResponse(1));
$this->assertSame(0, $this->getCommand()->parseResponse(0));
$this->assertSame(1, $this->getCommand()->parseResponse(1));
}
/**
@@ -62,8 +63,8 @@ class StringSetPreserveTest extends PredisCommandTestCase
{
$redis = $this->getClient();
$this->assertTrue($redis->setnx('foo', 'bar'));
$this->assertFalse($redis->setnx('foo', 'barbar'));
$this->assertSame(1, $redis->setnx('foo', 'bar'));
$this->assertSame(0, $redis->setnx('foo', 'barbar'));
$this->assertEquals('bar', $redis->get('foo'));
}
}