From 38fafb22ba0c1a6f9aba7271aff6901e53e76a08 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Fri, 24 Jul 2015 15:42:56 +0200 Subject: [PATCH] Do not parse response to MSETNX into boolean value. --- src/Command/StringSetMultiplePreserve.php | 8 -------- tests/Predis/Command/StringSetMultiplePreserveTest.php | 7 ++++--- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/Command/StringSetMultiplePreserve.php b/src/Command/StringSetMultiplePreserve.php index 961422d9..b50de33a 100644 --- a/src/Command/StringSetMultiplePreserve.php +++ b/src/Command/StringSetMultiplePreserve.php @@ -24,12 +24,4 @@ class StringSetMultiplePreserve extends StringSetMultiple { return 'MSETNX'; } - - /** - * {@inheritdoc} - */ - public function parseResponse($data) - { - return (bool) $data; - } } diff --git a/tests/Predis/Command/StringSetMultiplePreserveTest.php b/tests/Predis/Command/StringSetMultiplePreserveTest.php index 3a72aa95..e0d1765b 100644 --- a/tests/Predis/Command/StringSetMultiplePreserveTest.php +++ b/tests/Predis/Command/StringSetMultiplePreserveTest.php @@ -66,7 +66,8 @@ class StringSetMultiplePreserveTest extends PredisCommandTestCase */ public function testParseResponse() { - $this->assertSame(true, $this->getCommand()->parseResponse(true)); + $this->assertSame(0, $this->getCommand()->parseResponse(0)); + $this->assertSame(1, $this->getCommand()->parseResponse(1)); } /** @@ -76,7 +77,7 @@ class StringSetMultiplePreserveTest extends PredisCommandTestCase { $redis = $this->getClient(); - $this->assertTrue($redis->msetnx('foo', 'bar', 'hoge', 'piyo')); + $this->assertSame(1, $redis->msetnx('foo', 'bar', 'hoge', 'piyo')); $this->assertSame('bar', $redis->get('foo')); $this->assertSame('piyo', $redis->get('hoge')); } @@ -90,7 +91,7 @@ class StringSetMultiplePreserveTest extends PredisCommandTestCase $redis->set('foo', 'bar'); - $this->assertFalse($redis->msetnx('foo', 'barbar', 'hoge', 'piyo')); + $this->assertSame(0, $redis->msetnx('foo', 'barbar', 'hoge', 'piyo')); $this->assertSame('bar', $redis->get('foo')); $this->assertSame(0, $redis->exists('hoge')); }