From c5aabb80da8c1b7d9de0949407aaff9d78532532 Mon Sep 17 00:00:00 2001 From: Soenke Ruempler Date: Sat, 31 May 2014 00:48:20 +0200 Subject: [PATCH 1/3] Fix RedisArray test setup The former test setup did actually not test anything with a RedisArray as the constructor never constructed one. --- tests/Stash/Test/Driver/RedisArrayTest.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/Stash/Test/Driver/RedisArrayTest.php b/tests/Stash/Test/Driver/RedisArrayTest.php index 8878c178..1593ecfd 100644 --- a/tests/Stash/Test/Driver/RedisArrayTest.php +++ b/tests/Stash/Test/Driver/RedisArrayTest.php @@ -40,9 +40,24 @@ protected function setUp() protected function getOptions() { return array( - array('server' => $this->redisServer, 'port' => $this->redisPort, 'ttl' => 0.1), - array('server' => $this->redisSecondServer, 'port' => $this->redisSecondPort, 'ttl' => 0.1), + 'servers' => array( + array('server' => $this->redisServer, 'port' => $this->redisPort, 'ttl' => 0.1), + array('server' => $this->redisSecondServer, 'port' => $this->redisSecondPort, 'ttl' => 0.1), + ), ); } + /** + * @test + */ + public function itShouldConstructARedisArray() + { + $driver = $this->getFreshDriver(); + $class = new \ReflectionClass($driver); + $redisProperty = $class->getProperty('redis'); + $redisProperty->setAccessible(true); + $redisArray = $redisProperty->getValue($driver); + + $this->assertInstanceOf('\RedisArray', $redisArray); + } } From 423cac068a46971a55e60085fee366c961561bd1 Mon Sep 17 00:00:00 2001 From: Boris Erdmann Date: Fri, 30 May 2014 22:19:10 +0200 Subject: [PATCH 2/3] do not call close on RedisArray objects because they don't have a close method --- src/Stash/Driver/Redis.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Stash/Driver/Redis.php b/src/Stash/Driver/Redis.php index 88bd2eb9..f8371c5e 100644 --- a/src/Stash/Driver/Redis.php +++ b/src/Stash/Driver/Redis.php @@ -173,7 +173,9 @@ public function setOptions(array $options = array()) */ public function __destruct() { - $this->redis->close(); + if ($this->redis instanceof \Redis) { + $this->redis->close(); + } } /** From eaa1eb73b40b18ec665ce9d4f40890f82d724034 Mon Sep 17 00:00:00 2001 From: Soenke Ruempler Date: Sat, 31 May 2014 02:01:55 +0200 Subject: [PATCH 3/3] RedisArray currently not supported by HHVM. --- tests/Stash/Test/Driver/RedisArrayTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/Stash/Test/Driver/RedisArrayTest.php b/tests/Stash/Test/Driver/RedisArrayTest.php index 1593ecfd..fbc7524d 100644 --- a/tests/Stash/Test/Driver/RedisArrayTest.php +++ b/tests/Stash/Test/Driver/RedisArrayTest.php @@ -24,6 +24,10 @@ class RedisArrayTest extends RedisTest protected function setUp() { + if (defined('HHVM_VERSION')) { + $this->markTestSkipped('RedisArray currently not supported by HHVM.'); + } + parent::setUp(); if (!($sock = @fsockopen($this->redisServer, $this->redisPort, $errno, $errstr, 1))) {