Do not parse response to HSETNX into boolean value.

This commit is contained in:
Daniele Alessandri
2015-07-24 15:27:31 +02:00
parent ae26ecc8bf
commit 3fdfc50683
2 changed files with 5 additions and 13 deletions
-8
View File
@@ -24,12 +24,4 @@ class HashSetPreserve extends Command
{
return 'HSETNX';
}
/**
* {@inheritdoc}
*/
public function parseResponse($data)
{
return (bool) $data;
}
}
+5 -5
View File
@@ -54,8 +54,8 @@ class HashSetPreserveTest extends PredisCommandTestCase
{
$command = $this->getCommand();
$this->assertTrue($command->parseResponse(1));
$this->assertFalse($command->parseResponse(0));
$this->assertSame(0, $command->parseResponse(0));
$this->assertSame(1, $command->parseResponse(1));
}
/**
@@ -65,9 +65,9 @@ class HashSetPreserveTest extends PredisCommandTestCase
{
$redis = $this->getClient();
$this->assertTrue($redis->hsetnx('metavars', 'foo', 'bar'));
$this->assertTrue($redis->hsetnx('metavars', 'hoge', 'piyo'));
$this->assertFalse($redis->hsetnx('metavars', 'foo', 'barbar'));
$this->assertSame(1, $redis->hsetnx('metavars', 'foo', 'bar'));
$this->assertSame(1, $redis->hsetnx('metavars', 'hoge', 'piyo'));
$this->assertSame(0, $redis->hsetnx('metavars', 'foo', 'barbar'));
$this->assertSame(array('bar', 'piyo'), $redis->hmget('metavars', 'foo', 'hoge'));
}