Explorar o código

Do not parse response to PERSIST into boolean value.

Daniele Alessandri %!s(int64=9) %!d(string=hai) anos
pai
achega
44e92d8a2f
Modificáronse 2 ficheiros con 5 adicións e 13 borrados
  1. 0 8
      src/Command/KeyPersist.php
  2. 5 5
      tests/Predis/Command/KeyPersistTest.php

+ 0 - 8
src/Command/KeyPersist.php

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

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

@@ -54,8 +54,8 @@ class KeyPersistTest 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));
     }
 
     /**
@@ -68,7 +68,7 @@ class KeyPersistTest extends PredisCommandTestCase
         $redis->set('foo', 'bar');
         $redis->expire('foo', 10);
 
-        $this->assertTrue($redis->persist('foo'));
+        $this->assertSame(1, $redis->persist('foo'));
         $this->assertSame(-1, $redis->ttl('foo'));
     }
 
@@ -81,7 +81,7 @@ class KeyPersistTest extends PredisCommandTestCase
 
         $redis->set('foo', 'bar');
 
-        $this->assertFalse($redis->persist('foo'));
+        $this->assertSame(0, $redis->persist('foo'));
     }
 
     /**
@@ -91,6 +91,6 @@ class KeyPersistTest extends PredisCommandTestCase
     {
         $redis = $this->getClient();
 
-        $this->assertFalse($redis->persist('foo'));
+        $this->assertSame(0, $redis->persist('foo'));
     }
 }