浏览代码

Fixed tests against the current Redis master branch.

Daniele Alessandri 15 年之前
父节点
当前提交
5cae45282d
共有 1 个文件被更改,包括 8 次插入6 次删除
  1. 8 6
      test/RedisCommandsTest.php

+ 8 - 6
test/RedisCommandsTest.php

@@ -332,9 +332,10 @@ class RedisCommandTestSuite extends PHPUnit_Framework_TestCase {
     /* commands operating on lists */
 
     function testPushTail() {
-        $this->assertTrue($this->redis->pushTail('metavars', 'foo'));
+        // NOTE: List push operations return the list length since Redis commit 520b5a3
+        $this->assertEquals(1, $this->redis->pushTail('metavars', 'foo'));
         $this->assertTrue($this->redis->exists('metavars'));
-        $this->assertTrue($this->redis->pushTail('metavars', 'hoge'));
+        $this->assertEquals(2, $this->redis->pushTail('metavars', 'hoge'));
 
         // should throw an exception when trying to do a RPUSH on non-list types
         // should throw an exception when trying to do a LPUSH on non-list types
@@ -345,9 +346,10 @@ class RedisCommandTestSuite extends PHPUnit_Framework_TestCase {
     }
 
     function testPushHead() {
-        $this->assertTrue($this->redis->pushHead('metavars', 'foo'));
+        // NOTE: List push operations return the list length since Redis commit 520b5a3
+        $this->assertEquals(1, $this->redis->pushHead('metavars', 'foo'));
         $this->assertTrue($this->redis->exists('metavars'));
-        $this->assertTrue($this->redis->pushHead('metavars', 'hoge'));
+        $this->assertEquals(2, $this->redis->pushHead('metavars', 'hoge'));
 
         // should throw an exception when trying to do a LPUSH on non-list types
         RC::testForServerException($this, RC::EXCEPTION_WRONG_TYPE, function($test) {
@@ -357,8 +359,8 @@ class RedisCommandTestSuite extends PHPUnit_Framework_TestCase {
     }
 
     function testListLength() {
-        $this->assertTrue($this->redis->pushTail('metavars', 'foo'));
-        $this->assertTrue($this->redis->pushTail('metavars', 'hoge'));
+        $this->assertEquals(1, $this->redis->pushTail('metavars', 'foo'));
+        $this->assertEquals(2, $this->redis->pushTail('metavars', 'hoge'));
         $this->assertEquals(2, $this->redis->listLength('metavars'));
 
         $this->assertEquals(0, $this->redis->listLength('doesnotexist'));