Exemplo n.º 1
0
 /**
  * getDefaultOptions
  *
  * Add a replacement for DURATION, conditionally set depending on debug,
  *
  * @return array
  */
 protected function getDefaultOptions()
 {
     parent::getDefaultOptions();
     if (!isset($this->defaultOptions['replacements']['DURATION'])) {
         $duration = $this->debug() ? '+10 seconds' : '+999 days';
         $this->defaultOptions['replacements']['DURATION'] = $duration;
     }
     return $this->defaultOptions;
 }
Exemplo n.º 2
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());
 }