From 69bce63453d0e646f60d506989381b0845579cf1 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Sat, 24 Apr 2010 11:32:07 +0200 Subject: [PATCH] Test suite: added HGET. --- test/RedisCommandsTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/RedisCommandsTest.php b/test/RedisCommandsTest.php index 48e10e7f..92b89bb5 100644 --- a/test/RedisCommandsTest.php +++ b/test/RedisCommandsTest.php @@ -1458,6 +1458,20 @@ class RedisCommandTestSuite extends PHPUnit_Framework_TestCase { }); } + function testHashGet() { + $this->assertTrue($this->redis->hset('metavars', 'foo', 'bar')); + $this->assertEquals('bar', $this->redis->hget('metavars', 'foo')); + + $this->assertEquals('bar', $this->redis->hget('metavars', 'foo')); + $this->assertNull($this->redis->hget('metavars', 'hoge')); + $this->assertNull($this->redis->hget('hashDoesNotExist', 'field')); + + RC::testForServerException($this, RC::EXCEPTION_WRONG_TYPE, function($test) { + $test->redis->rpush('metavars', 'foo'); + $test->redis->hget('metavars', 'foo'); + }); + } + /* multiple databases handling commands */ function testSelectDatabase() {