diff --git a/CHANGELOG.md b/CHANGELOG.md index 88cb49cb3..04dc94821 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,10 @@ All notable changes to this project will be documented in this file, in reverse after creation. Wrong TTL was set instead of using default value from options. +- [#182](https://github.com/zendframework/zend-cache/pull/182) fixes + a typo in variable name within the `ExtMongoDbResourceManager::getResource` + method which prevented using custom db name when using that adapter. + ## 2.8.2 - 2018-05-01 ### Added diff --git a/src/Storage/Adapter/ExtMongoDbResourceManager.php b/src/Storage/Adapter/ExtMongoDbResourceManager.php index f9f9b518b..a2cf4a5a6 100644 --- a/src/Storage/Adapter/ExtMongoDbResourceManager.php +++ b/src/Storage/Adapter/ExtMongoDbResourceManager.php @@ -1,7 +1,7 @@ selectCollection( - isset($resouce['db']) ? $resource['db'] : 'zend', + isset($resource['db']) ? $resource['db'] : 'zend', isset($resource['collection']) ? $resource['collection'] : 'cache' ); $collection->createIndex(['key' => 1]); diff --git a/test/Storage/Adapter/ExtMongoDbResourceManagerTest.php b/test/Storage/Adapter/ExtMongoDbResourceManagerTest.php index ce02e50a4..7f88c16e3 100644 --- a/test/Storage/Adapter/ExtMongoDbResourceManagerTest.php +++ b/test/Storage/Adapter/ExtMongoDbResourceManagerTest.php @@ -1,7 +1,7 @@ assertSame($resource, $this->object->getResource($id)); } + public function testCorrectDatabaseResourceName() + { + $id = 'foo'; + + $resource = [ + 'db' => getenv('TESTS_ZEND_CACHE_EXTMONGODB_DATABASE'), + 'server' => getenv('TESTS_ZEND_CACHE_EXTMONGODB_CONNECTSTRING'), + ]; + + $this->object->setResource($id, $resource); + + $this->assertSame($resource['db'], $this->object->getResource($id)->getDatabaseName()); + } + public function testGetResourceNewResource() { $id = 'foo';