public function testClosureConnection() { ConnectionManager::add(function () { return "closure"; }, "closure"); $this->assertEquals("closure", ConnectionManager::get("closure")); }
/** * Helper method to get the schema collection. * * @return false|\Cake\Database\Schema\Collection */ protected function _getSchema() { $source = ConnectionManager::get($this->params['connection']); if (!method_exists($source, 'schemaCollection')) { $msg = sprintf('The "%s" connection is not compatible with orm caching, ' . 'as it does not implement a "schemaCollection()" method.', $this->params['connection']); $this->error($msg); return false; } $config = $source->config(); if (empty($config['cacheMetadata'])) { $this->_io->verbose('Metadata cache was disabled in config. Enabling to clear cache.'); $source->cacheMetadata(true); } return $source->schemaCollection(); }