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

Commit

Permalink
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Storage/Adapter/MemcachedOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function setLibOptions(array $libOptions)
}

$this->triggerOptionEvent('lib_options', $normalizedOptions);
$this->libOptions = array_merge($this->libOptions, $normalizedOptions);
$this->libOptions = array_diff_key($this->libOptions, $normalizedOptions) + $normalizedOptions;

return $this;
}
Expand Down
16 changes: 16 additions & 0 deletions test/Storage/Adapter/MemcachedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,22 @@ public function testOptionsSetServers()
$this->assertEquals($memcached->getOptions()->getServers(), $servers);
}

public function testLibOptionsSet()
{
$options = new Cache\Storage\Adapter\MemcachedOptions();

$options->setLibOptions(array(
'COMPRESSION' => false
));

$this->assertEquals($options->getLibOption(\Memcached::OPT_COMPRESSION), false);

$memcached = new Cache\Storage\Adapter\Memcached($options);
$this->assertEquals($memcached->getOptions()->getLibOptions(), array(
\Memcached::OPT_COMPRESSION => false
));
}

public function testNoOptionsSetsDefaultServer()
{
$memcached = new Cache\Storage\Adapter\Memcached();
Expand Down

0 comments on commit fbff658

Please sign in to comment.