Explorar el Código

Test suite: added HSETNX.

Daniele Alessandri hace 15 años
padre
commit
55404a2400
Se han modificado 1 ficheros con 11 adiciones y 0 borrados
  1. 11 0
      test/RedisCommandsTest.php

+ 11 - 0
test/RedisCommandsTest.php

@@ -1472,6 +1472,17 @@ class RedisCommandTestSuite extends PHPUnit_Framework_TestCase {
         });
         });
    }
    }
 
 
+    function testHashSetPreserve() {
+        $this->assertTrue($this->redis->hsetnx('metavars', 'foo', 'bar'));
+        $this->assertFalse($this->redis->hsetnx('metavars', 'foo', 'barbar'));
+        $this->assertEquals('bar', $this->redis->hget('metavars', 'foo'));
+
+        RC::testForServerException($this, RC::EXCEPTION_WRONG_TYPE, function($test) {
+            $test->redis->set('test', 'foobar');
+            $test->redis->hsetnx('test', 'hoge', 'piyo');
+        });
+    }
+
     /* multiple databases handling commands */
     /* multiple databases handling commands */
 
 
     function testSelectDatabase() {
     function testSelectDatabase() {