Example #1
0
 /**
  * testParseSqlite
  *
  * @return void
  */
 public function testParseSqlite()
 {
     $url = 'sqlite:///over/here.db';
     $dsn = DbDsn::parse($url);
     $this->assertInstanceOf('AD7six\\Dsn\\Db\\SqliteDsn', $dsn);
     $expected = ['engine' => 'sqlite', 'database' => '/over/here.db'];
     $return = $dsn->toArray();
     $this->assertSame($expected, $return, 'Default port should be in the parsed result');
     $this->assertSame($url, (string) $dsn, 'The regenerated dsn should be the same as the input');
 }
Example #2
0
File: Dibi.php Project: plispe/kiss
 /**
  * @return array
  */
 protected function getConnection()
 {
     /**
      * uses AD7six/php-dsn utility for parsing database DSN
      * @see https://github.com/AD7six/php-dsn
      */
     $dsn = new DbDsn(getenv('DATABASE_DSN'));
     return ['driver' => $dsn->getEngine(), 'host' => $dsn->getHost(), 'user' => $dsn->getUser(), 'password' => $dsn->getPassword(), 'database' => $dsn->getDatabase()];
 }