Ejemplo n.º 1
0
 public function testChangeRequestWithArray()
 {
     $urlTool = new UrlTool();
     $url = "/titi?tab[]=val_tab1&tab[]=val_tab2&key2=val2";
     $newUrl = $urlTool->changeRequestQueryString($url, "key2", "glou");
     $this->assertEquals("/titi?tab[]=val_tab1&tab[]=val_tab2&key2=glou", $newUrl);
     $newUrl = $urlTool->changeRequestQueryString($url, "tab", array("newval1", "newval2", "newval3"));
     $this->assertEquals("/titi?tab[]=newval1&tab[]=newval2&tab[]=newval3&key2=val2", $newUrl);
 }
Ejemplo n.º 2
0
 public function getSortUrl($fieldName)
 {
     $uri = $this->urlTool->changeRequestQueryString($this->requestUri, $this->getSortFieldFormName(), $fieldName);
     if ($fieldName == $this->getSortField()) {
         $order = $this->getSortOrder() == "ASC" ? "DESC" : "ASC";
     } else {
         $order = "ASC";
     }
     return $this->urlTool->changeRequestQueryString($uri, $this->getSortOrderFormName(), $order);
 }
Ejemplo n.º 3
0
 public function testChangeRequestQueryString()
 {
     $urlTool = new UrlTool();
     $url = "/titi?key1=val1&key2=val2";
     $newUrl = $urlTool->changeRequestQueryString($url, "key1", "test");
     $this->assertEquals("/titi?key1=test&key2=val2", $newUrl);
     $newUrl = $urlTool->changeRequestQueryString($url, array("key1" => "test1", "key2" => "test2"));
     $this->assertEquals("/titi?key1=test1&key2=test2", $newUrl);
     $newUrl = $urlTool->changeRequestQueryString($url, "key3", "val3");
     $this->assertEquals("/titi?key1=val1&key2=val2&key3=val3", $newUrl);
 }
Ejemplo n.º 4
0
 public function getUrl($key, $val)
 {
     return $this->urlTool->changeRequestQueryString($this->requestUri, $this->paginatorConfig->getRequestQueryName($key), $val);
 }