Pārlūkot izejas kodu

Test suite: added HSET.

Daniele Alessandri 15 gadi atpakaļ
vecāks
revīzija
c227eedbb7
1 mainītis faili ar 14 papildinājumiem un 0 dzēšanām
  1. 14 0
      test/RedisCommandsTest.php

+ 14 - 0
test/RedisCommandsTest.php

@@ -1444,6 +1444,20 @@ class RedisCommandTestSuite extends PHPUnit_Framework_TestCase {
         });
     }
 
+    /* commands operating on hashes */
+
+    function testHashSet() {
+        $this->assertTrue($this->redis->hset('metavars', 'foo', 'bar'));
+        $this->assertTrue($this->redis->hset('metavars', 'hoge', 'piyo'));
+        $this->assertEquals('bar', $this->redis->hget('metavars', 'foo'));
+        $this->assertEquals('piyo', $this->redis->hget('metavars', 'hoge'));
+
+        RC::testForServerException($this, RC::EXCEPTION_WRONG_TYPE, function($test) {
+            $test->redis->set('test', 'foobar');
+            $test->redis->hset('test', 'hoge', 'piyo');
+        });
+    }
+
     /* multiple databases handling commands */
 
     function testSelectDatabase() {