Sfoglia il codice sorgente

Do not parse response to HEXISTS into boolean value.

Daniele Alessandri 9 anni fa
parent
commit
231a3440f7
2 ha cambiato i file con 5 aggiunte e 13 eliminazioni
  1. 0 8
      src/Command/HashExists.php
  2. 5 5
      tests/Predis/Command/HashExistsTest.php

+ 0 - 8
src/Command/HashExists.php

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

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

@@ -54,8 +54,8 @@ class HashExistsTest extends PredisCommandTestCase
     {
         $command = $this->getCommand();
 
-        $this->assertFalse($command->parseResponse(0));
-        $this->assertTrue($command->parseResponse(1));
+        $this->assertSame(0, $command->parseResponse(0));
+        $this->assertSame(1, $command->parseResponse(1));
     }
 
     /**
@@ -67,9 +67,9 @@ class HashExistsTest extends PredisCommandTestCase
 
         $redis->hmset('metavars', 'foo', 'bar', 'hoge', 'piyo');
 
-        $this->assertTrue($redis->hexists('metavars', 'foo'));
-        $this->assertFalse($redis->hexists('metavars', 'lol'));
-        $this->assertFalse($redis->hexists('unknown', 'foo'));
+        $this->assertSame(1, $redis->hexists('metavars', 'foo'));
+        $this->assertSame(0, $redis->hexists('metavars', 'lol'));
+        $this->assertSame(0, $redis->hexists('unknown', 'foo'));
     }
 
     /**