Thanks to visit codestin.com
Credit goes to github.com

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

Commit e5660fb

Browse files
committed
Merge branch 'hotfix/182'
Close #182 Fix #181
2 parents e92dade + b6ba249 commit e5660fb

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ All notable changes to this project will be documented in this file, in reverse
2727
after creation. Wrong TTL was set instead of using default value
2828
from options.
2929

30+
- [#182](https://github.com/zendframework/zend-cache/pull/182) fixes
31+
a typo in variable name within the `ExtMongoDbResourceManager::getResource`
32+
method which prevented using custom db name when using that adapter.
33+
3034
## 2.8.2 - 2018-05-01
3135

3236
### Added

src/Storage/Adapter/ExtMongoDbResourceManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* @see https://github.com/zendframework/zend-cache for the canonical source repository
4-
* @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com)
4+
* @copyright Copyright (c) 2018-2019 Zend Technologies USA Inc. (https://www.zend.com)
55
* @license https://github.com/zendframework/zend-cache/blob/master/LICENSE.md New BSD License
66
*/
77

@@ -98,7 +98,7 @@ public function getResource($id)
9898
}
9999

100100
$collection = $resource['client_instance']->selectCollection(
101-
isset($resouce['db']) ? $resource['db'] : 'zend',
101+
isset($resource['db']) ? $resource['db'] : 'zend',
102102
isset($resource['collection']) ? $resource['collection'] : 'cache'
103103
);
104104
$collection->createIndex(['key' => 1]);

test/Storage/Adapter/ExtMongoDbResourceManagerTest.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
33
* @see https://github.com/zendframework/zend-cache for the canonical source repository
4-
* @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com)
4+
* @copyright Copyright (c) 2018-2019 Zend Technologies USA Inc. (https://www.zend.com)
55
* @license https://github.com/zendframework/zend-cache/blob/master/LICENSE.md New BSD License
66
*/
77

@@ -12,7 +12,6 @@
1212
use PHPUnit\Framework\TestCase;
1313
use stdClass;
1414
use Zend\Cache\Exception;
15-
use Zend\Cache\Storage\Adapter\ExtMongoDbOptions;
1615
use Zend\Cache\Storage\Adapter\ExtMongoDbResourceManager;
1716

1817
/**
@@ -117,6 +116,20 @@ public function testGetResourceInitialized()
117116
$this->assertSame($resource, $this->object->getResource($id));
118117
}
119118

119+
public function testCorrectDatabaseResourceName()
120+
{
121+
$id = 'foo';
122+
123+
$resource = [
124+
'db' => getenv('TESTS_ZEND_CACHE_EXTMONGODB_DATABASE'),
125+
'server' => getenv('TESTS_ZEND_CACHE_EXTMONGODB_CONNECTSTRING'),
126+
];
127+
128+
$this->object->setResource($id, $resource);
129+
130+
$this->assertSame($resource['db'], $this->object->getResource($id)->getDatabaseName());
131+
}
132+
120133
public function testGetResourceNewResource()
121134
{
122135
$id = 'foo';

0 commit comments

Comments
 (0)