Esempio n. 1
0
 /**
  * testMapUsage
  *
  * Map custom schemes in the dsn class to mysql for the default port (convenience only)
  * Map custom schemes in the wrapper class to a custom datasources
  *
  * @dataProvider mapUsageProvider
  * @return void
  */
 public function testMapUsage($url, $expected)
 {
     Dsn::map(['nysql' => '\\AD7six\\Dsn\\Db\\MysqlDsn', 'oysql' => '\\AD7six\\Dsn\\Db\\MysqlDsn']);
     DbDsn::map(['mongo' => 'MongoDb.MongodbSource', 'mysql' => 'Plugin.DboClass', 'nysql' => 'Plugin.Directory/DboClass', 'oysql' => 'Plugin.Directory/SubDirectory/DboClass']);
     $dsn = new DbDsn($url);
     $return = $dsn->toArray();
     $this->assertSame($expected, $return, 'The url should parse as expected');
     $return = $dsn->__toString();
     $this->assertSame($url, $return, 'The dsn should parse back to the same url');
 }