Quellcode durchsuchen

Bugfix: replies to DEL commands must not be converted to a boolean response as DEL returns the number of keys removed.

Daniele Alessandri vor 15 Jahren
Ursprung
Commit
0664bde7e9
3 geänderte Dateien mit 3 neuen und 5 gelöschten Zeilen
  1. 0 1
      lib/Predis.php
  2. 1 2
      lib/Predis_Compatibility.php
  3. 2 2
      test/RedisCommandsTest.php

+ 0 - 1
lib/Predis.php

@@ -1880,7 +1880,6 @@ class Exists extends \Predis\MultiBulkCommand {
 
 class Delete extends \Predis\MultiBulkCommand {
     public function getCommandId() { return 'DEL'; }
-    public function parseResponse($data) { return (bool) $data; }
 }
 
 class Type extends \Predis\MultiBulkCommand {

+ 1 - 2
lib/Predis_Compatibility.php

@@ -209,7 +209,6 @@ class Exists extends \Predis\InlineCommand {
 
 class Delete extends \Predis\InlineCommand {
     public function getCommandId() { return 'DEL'; }
-    public function parseResponse($data) { return (bool) $data; }
 }
 
 class Type extends \Predis\InlineCommand {
@@ -498,4 +497,4 @@ class SlaveOf extends \Predis\InlineCommand {
         return $arguments;
     }
 }
-?>
+?>

+ 2 - 2
test/RedisCommandsTest.php

@@ -184,9 +184,9 @@ class RedisCommandTestSuite extends PHPUnit_Framework_TestCase {
 
     function testDelete() {
         $this->redis->set('foo', 'bar');
-        $this->assertTrue($this->redis->del('foo'));
+        $this->assertEquals(1, $this->redis->del('foo'));
         $this->assertFalse($this->redis->exists('foo'));
-        $this->assertFalse($this->redis->del('foo'));
+        $this->assertEquals(0, $this->redis->del('foo'));
     }
 
     function testType() {