Browse Source

Added more tests for RPOPLPUSH

Daniele Alessandri 15 years ago
parent
commit
1a3bd9fa41
1 changed files with 13 additions and 1 deletions
  1. 13 1
      test/RedisCommandsTest.php

+ 13 - 1
test/RedisCommandsTest.php

@@ -507,7 +507,6 @@ class RedisCommandTestSuite extends PHPUnit_Framework_TestCase {
 
     function testListPushTailPopFist() {
         $numbers = RC::pushTailAndReturn($this->redis, 'numbers', array(0, 1, 2));
-
         $this->assertEquals(0, $this->redis->listLength('temporary'));
         $this->assertEquals(2, $this->redis->listPushTailPopFist('numbers', 'temporary'));
         $this->assertEquals(1, $this->redis->listPushTailPopFist('numbers', 'temporary'));
@@ -517,10 +516,23 @@ class RedisCommandTestSuite extends PHPUnit_Framework_TestCase {
         $this->assertEquals(array(), $this->redis->listRange('numbers', 0, -1));
         $this->assertEquals($numbers, $this->redis->listRange('temporary', 0, -1));
 
+        $numbers = RC::pushTailAndReturn($this->redis, 'numbers', array(0, 1, 2));
+        $this->redis->listPushTailPopFist('numbers', 'numbers');
+        $this->redis->listPushTailPopFist('numbers', 'numbers');
+        $this->redis->listPushTailPopFist('numbers', 'numbers');
+        $this->assertEquals($numbers, $this->redis->listRange('numbers', 0, -1));
+
+        $this->assertEquals(null, $this->redis->listPushTailPopFist('listDoesNotExist1', 'listDoesNotExist2'));
+
         RC::testForServerException($this, RC::EXCEPTION_WRONG_TYPE, function($test) {
             $test->redis->set('foo', 'bar');
             $test->redis->listPushTailPopFist('foo', 'hoge');
         });
+
+        RC::testForServerException($this, RC::EXCEPTION_WRONG_TYPE, function($test) {
+            $test->redis->set('foo', 'bar');
+            $test->redis->listPushTailPopFist('temporary', 'foo');
+        });
     }