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

Commit

Permalink
Merge commit 'refs/pull/3630/head' of github.com:zendframework/zf2 in…
Browse files Browse the repository at this point in the history
…to hotfix/memcached-options
  • Loading branch information
Maks3w committed Feb 1, 2013
2 parents 356ab3b + 227d7fa commit 13fb3c5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Storage/Adapter/MemcachedResourceManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/Storage/Adapter/CommonAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
21 changes: 21 additions & 0 deletions test/Storage/Adapter/MemcachedResourceManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 13fb3c5

Please sign in to comment.