Index: library/Zend/Application/Resource/ResourceAbstract.php =================================================================== --- library/Zend/Application/Resource/ResourceAbstract.php (revision 23382) +++ library/Zend/Application/Resource/ResourceAbstract.php (working copy) @@ -83,6 +83,11 @@ */ public function setOptions(array $options) { + if (array_key_exists('bootstrap', $options)) { + $this->setBootstrap($options['bootstrap']); + unset($options['bootstrap']); + } + foreach ($options as $key => $value) { if (in_array(strtolower($key), $this->_skipOptions)) { continue; @@ -92,9 +97,6 @@ if (method_exists($this, $method)) { $this->$method($value); } - if ('bootstrap' === $key) { - unset($options[$key]); - } } $this->_options = $this->mergeOptions($this->_options, $options); Index: tests/Zend/Application/Resource/DbTest.php =================================================================== --- tests/Zend/Application/Resource/DbTest.php (revision 23382) +++ tests/Zend/Application/Resource/DbTest.php (working copy) @@ -223,6 +223,34 @@ $db = $resource->init(); $this->assertEquals($db->getFetchMode(), Zend_Db::FETCH_OBJ); } + + /** + * @group ZF-10543 + */ + public function testSetDefaultMetadataCacheThroughBootstrap() + { + $options = array( + 'resources' => array( + 'db' => array( + 'adapter' => 'Pdo_Sqlite', + 'params' => array( + 'dbname' => ':memory:' + ), + 'defaultMetadataCache' => 'default' + ), + 'cachemanager' => array( + 'default' => array( + 'backend' => array('name' => 'black-hole') + ) + ) + ) + ); + + $this->bootstrap->setOptions($options); + $this->bootstrap->bootstrap(); + $resource = $this->bootstrap->getResource('cachemanager'); + $this->assertEquals($resource->getCache('default'), Zend_Db_Table::getDefaultMetadataCache()); + } } if (PHPUnit_MAIN_METHOD == 'Zend_Application_Resource_DbTest::main') {