Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request #118 from marc-mabe/redis_fix_tests
Browse files Browse the repository at this point in the history
fixed redis tests in case running with different server
  • Loading branch information
marc-mabe committed Nov 4, 2016
2 parents 0fd28cf + c1e9d3b commit 21e486a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions test/Storage/Adapter/RedisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}

Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 21e486a

Please sign in to comment.