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

Commit

Permalink
Merge branch 'hotfix/4595' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Storage/Adapter/RedisOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,27 @@ public function getDatabase()
{
return $this->getResourceManager()->getDatabase($this->getResourceId());
}

/**
* Set resource password
*
* @param string $password Password
*
* @return RedisOptions
*/
public function setPassword($password)
{
$this->getResourceManager()->setPassword($this->getResourceId(), $password);
return $this;
}

/**
* Get resource password
*
* @return string
*/
public function getPassword()
{
return $this->getResourceManager()->getPassword($this->getResourceId());
}
}
1 change: 1 addition & 0 deletions src/Storage/AdapterPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class AdapterPluginManager extends AbstractPluginManager
'filesystem' => 'Zend\Cache\Storage\Adapter\Filesystem',
'memcached' => 'Zend\Cache\Storage\Adapter\Memcached',
'memory' => 'Zend\Cache\Storage\Adapter\Memory',
'redis' => 'Zend\Cache\Storage\Adapter\Redis',
'session' => 'Zend\Cache\Storage\Adapter\Session',
'xcache' => 'Zend\Cache\Storage\Adapter\XCache',
'wincache' => 'Zend\Cache\Storage\Adapter\WinCache',
Expand Down
7 changes: 7 additions & 0 deletions test/Storage/Adapter/RedisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,11 @@ public function testOptionsGetSetDatabase()
$this->assertEquals($database, $this->_options->getDatabase(), 'Database not set correctly using RedisOptions');
}

public function testOptionsGetSetPassword()
{
$password = 'my-secret';
$this->_options->setPassword($password);
$this->assertEquals($password, $this->_options->getPassword(), 'Password was set incorrectly using RedisOptions');
}

}

0 comments on commit 49fd44e

Please # to comment.