From c8554f2c8b17035fc06e4c2dffd2fea540de60c9 Mon Sep 17 00:00:00 2001 From: Daniele Alessandri Date: Sat, 27 Feb 2010 11:15:31 +0100 Subject: [PATCH] Added tests for APPEND. --- test/RedisCommandsTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/RedisCommandsTest.php b/test/RedisCommandsTest.php index 70908acd..92399170 100644 --- a/test/RedisCommandsTest.php +++ b/test/RedisCommandsTest.php @@ -65,6 +65,21 @@ class RedisCommandTestSuite extends PHPUnit_Framework_TestCase { }); } + function testAppend() { + $this->redis->set('foo', 'bar'); + $this->assertEquals(5, $this->redis->append('foo', '__')); + $this->assertEquals(8, $this->redis->append('foo', 'bar')); + $this->assertEquals('bar__bar', $this->redis->get('foo')); + + $this->assertEquals(4, $this->redis->append('hoge', 'piyo')); + $this->assertEquals('piyo', $this->redis->get('hoge')); + + RC::testForServerException($this, RC::EXCEPTION_WRONG_TYPE, function($test) { + $test->redis->pushTail('metavars', 'foo'); + $test->redis->append('metavars', 'bar'); + }); + } + /* commands operating on string values */ function testSet() {