mirror of
https://github.com/predis/predis.git
synced 2026-08-30 04:02:22 +00:00
Do not parse response to SETNX into boolean value.
This commit is contained in:
@@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user