public function testOptionsFluentInterface() { $options = $this->_storage->getOptions(); foreach ($options->toArray() as $option => $value) { $method = ucwords(str_replace('_', ' ', $option)); $method = 'set' . str_replace(' ', '', $method); $this->assertSame($options, $options->{$method}($value), "Method '{$method}' doesn't implement the fluent interface"); } $this->assertSame($this->_storage, $this->_storage->setOptions($options), "Method 'setOptions' doesn't implement the fluent interface"); }
/** * Instantiate a storage adapter * * @param string|Storage\Adapter $adapterName * @param array|Traversable|Storage\Adapter\AdapterOptions $options * @return Storage\Adapter * @throws Exception\RuntimeException */ public static function adapterFactory($adapterName, $options = array()) { if ($adapterName instanceof Storage\Adapter) { // $adapterName is already an adapter object $adapterName->setOptions($options); return $adapterName; } $adapter = static::getAdapterBroker()->load($adapterName); $adapter->setOptions($options); return $adapter; }