diff --git a/src/Storage/Adapter/MemcachedResourceManager.php b/src/Storage/Adapter/MemcachedResourceManager.php index 782461f04..8c35e036b 100644 --- a/src/Storage/Adapter/MemcachedResourceManager.php +++ b/src/Storage/Adapter/MemcachedResourceManager.php @@ -213,7 +213,7 @@ public function setLibOptions($id, array $libOptions) $resource = & $this->resources[$id]; if ($resource instanceof MemcachedResource) { if (method_exists($resource, 'setOptions')) { - $resource->setOptions($resource); + $resource->setOptions($libOptions); } else { foreach ($libOptions as $key => $value) { $resource->setOption($key, $value); diff --git a/test/Storage/Adapter/CommonAdapterTest.php b/test/Storage/Adapter/CommonAdapterTest.php index eb12f93c1..14f12bed5 100644 --- a/test/Storage/Adapter/CommonAdapterTest.php +++ b/test/Storage/Adapter/CommonAdapterTest.php @@ -1024,7 +1024,7 @@ public function testClearExpired() $this->assertTrue($this->_storage->hasItem('key2')); } - public function testTagable() + public function testTaggable() { if (!($this->_storage instanceof TaggableInterface)) { $this->markTestSkipped("Storage doesn't implement TaggableInterface"); diff --git a/test/Storage/Adapter/MemcachedResourceManagerTest.php b/test/Storage/Adapter/MemcachedResourceManagerTest.php index 566a7de1b..8ff111955 100644 --- a/test/Storage/Adapter/MemcachedResourceManagerTest.php +++ b/test/Storage/Adapter/MemcachedResourceManagerTest.php @@ -233,4 +233,25 @@ public function testValidResources($resourceId, $resource, $expectedPersistentId $this->assertSame($this->resourceManager, $this->resourceManager->removeResource($resourceId)); $this->assertFalse($this->resourceManager->hasResource($resourceId)); } + + public function testSetLibOptionsOnExistingResource() + { + $memcachedInstalled = class_exists('Memcached', false); + + $libOptions = array('compression' => false); + $resourceId = 'testResourceId'; + $resourceMock = $this->getMock('Memcached', array('setOptions')); + + if (!$memcachedInstalled) { + $this->setExpectedException('Zend\Cache\Exception\InvalidArgumentException'); + } else { + $resourceMock + ->expects($this->once()) + ->method('setOptions') + ->with($this->isType('array')); + } + + $this->resourceManager->setResource($resourceId, $resourceMock); + $this->resourceManager->setLibOptions($resourceId, $libOptions); + } }