Example #1
0
 /**
  * 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']])));
     });
 }
Example #2
0
 /**
  * @param $config
  */
 protected function initialize($config)
 {
     /** @var ConnectionInterface $factory */
     $driver = Factory::create($config);
     $this->database = new Db($driver);
 }
Example #3
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testThrowsExceptionWithoutDriverSpecified()
 {
     Factory::create([]);
 }