コード例 #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');
 }
コード例 #2
0
 /**
  * testMap
  *
  * @return void
  */
 public function testMap()
 {
     Dsn::map('special', '\\AD7six\\Dsn\\Test\\TestCase\\SpecialTestDsn');
     $dsn = Dsn::parse('special://host/path');
     $this->assertInstanceOf('\\AD7six\\Dsn\\Test\\TestCase\\SpecialTestDsn', $dsn, 'Modifying the scheme map should be honored');
 }