Esempio n. 1
0
 /**
  * @covers MediaCore\Uri::setParam
  */
 public function testSetParam()
 {
     $url = 'http://example.com/path/to/directory';
     $uri = new Uri($url);
     $uri->setParam('foo', 'bar');
     $expectedValue = array('foo' => 'bar');
     $this->assertEquals($expectedValue, $uri->getQueryAsArray());
     $url = 'http://example.com/path/to/directory?foo=bar';
     $uri = new Uri($url);
     $uri->setParam('foo', 'bar');
     $expectedValue = array('foo' => 'bar');
     $this->assertEquals($expectedValue, $uri->getQueryAsArray());
     $url = 'http://example.com/path/to/directory?foo=bar&foo=baz';
     $uri = new Uri($url);
     $uri->setParam('foo', 'bar');
     $expectedValue = array('foo' => array('bar', 'bar'));
     $this->assertEquals($expectedValue, $uri->getQueryAsArray());
 }
 public static function parseUrl($url = '')
 {
     empty($url) && ($uri = $_SERVER['REQUEST_URI']);
     Sys::S('core.Url.Uri');
     Uri::setParam(array('m', 'a'), array('pg', 'order'));
     self::$urlTpl = Uri::toPageUriTpl($_SERVER['REQUEST_URI']);
 }