/** * Database services */ public function services() { $this->registry->add('db', function () { $config = $this->registry->make('config')->get('database'); $default = $config['connections'][$config['default']]; return new Db(Factory::create(array_merge($default, ['fetch' => $config['fetch']]))); }); }
/** * @param $config */ protected function initialize($config) { /** @var ConnectionInterface $factory */ $driver = Factory::create($config); $this->database = new Db($driver); }
/** * @expectedException \InvalidArgumentException */ public function testThrowsExceptionWithoutDriverSpecified() { Factory::create([]); }