Пример #1
0
 public function testAdapterMap()
 {
     Dsn::map('service', 'UseThisAdapter');
     $expected = ['service' => 'UseThisAdapter'];
     $return = Dsn::map();
     $this->assertSame($expected, $return);
     $url = 'service://host/path';
     $dsn = new Dsn($url);
     $this->assertInstanceOf('AD7six\\Dsn\\Wrapper\\Dsn', $dsn);
     $this->assertSame('service', $dsn->scheme);
     $this->assertSame('service', $dsn->getScheme());
     $this->assertSame('UseThisAdapter', $dsn->adapter);
     $this->assertSame('UseThisAdapter', $dsn->getAdapter());
     $expected = ['adapter' => 'UseThisAdapter', 'scheme' => 'service', 'host' => 'host', 'path' => '/path'];
     $return = $dsn->toArray();
     $this->assertSame($expected, $return);
     $this->assertSame($url, $dsn->toUrl());
 }