From ecb3865a4045e5916580053cf76f0b6a47d8f57f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Proch=C3=A1zka?= Date: Thu, 25 Jul 2013 17:42:42 +0200 Subject: [PATCH] Fixed RedisClient::__set() [Fixes #12] --- src/Kdyby/Redis/RedisClient.php | 2 +- tests/KdybyTests/Redis/RedisClient.phpt | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Kdyby/Redis/RedisClient.php b/src/Kdyby/Redis/RedisClient.php index 6364e82..192621a 100644 --- a/src/Kdyby/Redis/RedisClient.php +++ b/src/Kdyby/Redis/RedisClient.php @@ -552,7 +552,7 @@ public function &__get($name) */ public function __set($name, $value) { - return $this->send('set', array($value)); + return $this->send('set', array($name, $value)); } diff --git a/tests/KdybyTests/Redis/RedisClient.phpt b/tests/KdybyTests/Redis/RedisClient.phpt index 1ae5df5..f04d55c 100644 --- a/tests/KdybyTests/Redis/RedisClient.phpt +++ b/tests/KdybyTests/Redis/RedisClient.phpt @@ -122,6 +122,18 @@ class RedisClientTest extends AbstractRedisTestCase }, 'Kdyby\Redis\TransactionException'); } + + + public function testMagicAccessors() + { + Assert::false(isset($this->client->nemam)); + $this->client->nemam = "nemam"; + Assert::true(isset($this->client->nemam)); + Assert::same("nemam", $this->client->nemam); + unset($this->client->nemam); + Assert::false(isset($this->client->nemam)); + } + } \run(new RedisClientTest());