diff --git a/CHANGELOG.md b/CHANGELOG.md index 35466f91d..bb226e053 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,8 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed +- [#118](https://github.com/zendframework/zend-cache/pull/118) + fixed redis tests in case running with different server - [#119](https://github.com/zendframework/zend-cache/pull/119) Redis: Don't call method Redis::info() every time - [#113](https://github.com/zendframework/zend-cache/pull/113) diff --git a/test/Storage/Adapter/RedisTest.php b/test/Storage/Adapter/RedisTest.php index 7b03ff8bb..5a8f02a7e 100644 --- a/test/Storage/Adapter/RedisTest.php +++ b/test/Storage/Adapter/RedisTest.php @@ -119,14 +119,12 @@ public function testRedisSetBoolean() public function testGetCapabilitiesTtl() { - $host = getenv('TESTS_ZEND_CACHE_REDIS_HOST') ? : '127.0.0.1'; - $port = getenv('TESTS_ZEND_CACHE_REDIS_PORT') ? : 6379; - $redisResource = new RedisResource(); - $redisResource->connect($host, $port); - $info = $redisResource->info(); - $majorVersion = (int) $info['redis_version']; + $resourceManager = $this->_options->getResourceManager(); + $resourceId = $this->_options->getResourceId(); + $redis = $resourceManager->getResource($resourceId); + $majorVersion = (int) $redis->info()['redis_version']; - $this->assertEquals($majorVersion, $this->_options->getResourceManager()->getMajorVersion($this->_options->getResourceId())); + $this->assertEquals($majorVersion, $resourceManager->getMajorVersion($resourceId)); $capabilities = $this->_storage->getCapabilities(); if ($majorVersion < 2) { @@ -145,6 +143,7 @@ public function testSocketConnection() $normalized = $this->_options->getResourceManager()->getServer($this->_options->getResourceId()); $this->assertEquals($socket, $normalized['host'], 'Host should equal to socket {$socket}'); + // Don't try to flush on shutdown $this->_storage = null; } @@ -271,6 +270,9 @@ public function testGetSetServer() ]; $this->_options->setServer($server); $this->assertEquals($server, $this->_options->getServer(), 'Server was not set correctly through RedisOptions'); + + // Don't try to flush on shutdown + $this->_storage = null; } public function testOptionsGetSetDatabase()