/** * @param Container $app * @param string $prefix * * @return \PDO */ protected function getPdo(Container $app, $prefix) { return function () use($app, $prefix) { $factory = new PdoConfigFactory(); $app[$prefix . '.server'] = array_merge(array('driver' => 'sqlite'), isset($app[$prefix . '.server']) ? (array) $app[$prefix . '.server'] : array()); $params = array_merge($app[$prefix . '.server'], array('options' => isset($app[$prefix . '.options']) ? (array) $app[$prefix . '.options'] : array()), array('attributes' => isset($app[$prefix . '.attributes']) ? (array) $app[$prefix . '.attributes'] : array())); $cfg = $factory->createConfig($params['driver']); return $cfg->connect($params); }; }
/** * @dataProvider dataProviderCreateConfig */ public function testCreateConfig($params, $expected) { $this->assertInstanceOf($expected, $this->factory->createConfig($params['driver'])); }