Do not parse response to RENAMENX into boolean value.

This commit is contained in:
Daniele Alessandri
2015-07-24 15:37:58 +02:00
parent 44e92d8a2f
commit fda9f022dd
2 changed files with 4 additions and 12 deletions
-8
View File
@@ -24,12 +24,4 @@ class KeyRenamePreserve extends KeyRename
{
return 'RENAMENX';
}
/**
* {@inheritdoc}
*/
public function parseResponse($data)
{
return (bool) $data;
}
}
@@ -52,8 +52,8 @@ class KeyRenamePreserveTest extends PredisCommandTestCase
*/
public function testParseResponse()
{
$this->assertTrue($this->getCommand()->parseResponse(1));
$this->assertFalse($this->getCommand()->parseResponse(0));
$this->assertSame(0, $this->getCommand()->parseResponse(0));
$this->assertSame(1, $this->getCommand()->parseResponse(1));
}
/**
@@ -65,7 +65,7 @@ class KeyRenamePreserveTest extends PredisCommandTestCase
$redis->set('foo', 'bar');
$this->assertTrue($redis->renamenx('foo', 'foofoo'));
$this->assertSame(1, $redis->renamenx('foo', 'foofoo'));
$this->assertSame(0, $redis->exists('foo'));
$this->assertSame(1, $redis->exists('foofoo'));
}
@@ -79,6 +79,6 @@ class KeyRenamePreserveTest extends PredisCommandTestCase
{
$redis = $this->getClient();
$this->assertFalse($redis->renamenx('foo', 'foobar'));
$this->assertSame(0, $redis->renamenx('foo', 'foobar'));
}
}