소스 검색

Do not parse response to HSETNX into boolean value.

Daniele Alessandri 9 년 전
부모
커밋
3fdfc50683
2개의 변경된 파일5개의 추가작업 그리고 13개의 파일을 삭제
  1. 0 8
      src/Command/HashSetPreserve.php
  2. 5 5
      tests/Predis/Command/HashSetPreserveTest.php

+ 0 - 8
src/Command/HashSetPreserve.php

@@ -24,12 +24,4 @@ class HashSetPreserve extends Command
     {
         return 'HSETNX';
     }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function parseResponse($data)
-    {
-        return (bool) $data;
-    }
 }

+ 5 - 5
tests/Predis/Command/HashSetPreserveTest.php

@@ -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'));
     }