From 08afdfac1bcfe4dfb5eb2e4e5d0e2c562454408d Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Mon, 10 May 2010 11:27:26 +0200 Subject: [PATCH] Trying to increment a string value associated to an hash now raises an error. --- test/PredisShared.php | 1 + test/RedisCommandsTest.php | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test/PredisShared.php b/test/PredisShared.php index 37310b9f..b99b1920 100644 --- a/test/PredisShared.php +++ b/test/PredisShared.php @@ -24,6 +24,7 @@ class RC { const EXCEPTION_VALUE_NOT_INT = 'value is not an integer'; const EXCEPTION_EXEC_NO_MULTI = 'EXEC without MULTI'; const EXCEPTION_SETEX_TTL = 'invalid expire time in SETEX'; + const EXCEPTION_HASH_VALNOTINT = 'hash value is not an integer'; private static $_connection; diff --git a/test/RedisCommandsTest.php b/test/RedisCommandsTest.php index 4bfefd47..cacc85a1 100644 --- a/test/RedisCommandsTest.php +++ b/test/RedisCommandsTest.php @@ -1546,8 +1546,10 @@ class RedisCommandTestSuite extends PHPUnit_Framework_TestCase { $this->assertEquals(20, $this->redis->hincrby('hash', 'counter', 10)); $this->assertEquals(0, $this->redis->hincrby('hash', 'counter', -20)); - $this->assertTrue($this->redis->hset('hash', 'field', 'stringvalue')); - $this->assertEquals(10, $this->redis->hincrby('hash', 'field', 10)); + RC::testForServerException($this, RC::EXCEPTION_HASH_VALNOTINT, function($test) { + $test->redis->hset('hash', 'field', 'stringvalue'); + $test->redis->hincrby('hash', 'field', 10); + }); RC::testForServerException($this, RC::EXCEPTION_WRONG_TYPE, function($test) { $test->redis->set('foo', 'bar');