function testNotifyExternalUrl() { $observer = new lmbInnerUriNormalizerObserver(new lmbUri('http://test.com')); $this->reader->expectOnce('getUri'); $this->reader->setReturnReference('getUri', $uri = new lmbUri('http://test2.com/page.html')); $observer->notify($this->reader); $this->assertEqual($uri->toString(), 'http://test2.com/page.html'); }
/** * @param string|lmbUri $dsn * @return lmbLogWriter */ function createLogWriterByDSN($dsn) { if (!is_object($dsn)) { $dsn = new lmbUri($dsn); } if (!$dsn->getProtocol()) { throw new lmbException('Empty log writer type', array('dsn' => $dsn->toString())); } $writer_name = 'lmbLog' . ucfirst($dsn->getProtocol()) . 'Writer'; $writer_file = 'limb/log/src/writers/' . $writer_name . '.class.php'; try { lmb_require($writer_file); $writer = new $writer_name($dsn); return $writer; } catch (lmbFileNotFoundException $e) { throw new lmbFileNotFoundException($writer_file, 'Log writer not found'); } }
function testChaining() { $uri = new lmbUri(); $uri->addQueryItem('chaining', 'supported')->setHost('everywhere.com')->setPath('/')->setProtocol('http'); $this->assertEqual('http://everywhere.com/?chaining=supported', $uri->toString()); }
function testToString_IfAttributeNoValidStringURL() { $str = 'http://*****:*****@localhost:81/test.php?foo=' . urlencode('10&b=11') . '#23'; $uri = new lmbUri($str); $this->assertEqual($uri->toString(), $str); }