Example #1
0
 public function testShortCutFunction()
 {
     $url = 'https://www.google.com/';
     $this->assertEquals($url, url($url));
     $this->assertEquals($url, url($url, [], true));
     $this->assertEquals($url, url($url, [], true, 'www.google.com'));
     $this->assertEquals($url, url($url, [], true, 'www.google.com/'));
     $url_not_secure = 'http://www.google.com/';
     $this->assertEquals($url_not_secure, url($url_not_secure));
     $this->assertEquals($url, url($url_not_secure, [], true));
     $url_not_secure_no_slash = 'http://www.google.com';
     $this->assertEquals($url_not_secure_no_slash . '/', url($url_not_secure_no_slash));
     $this->assertEquals($url, url($url_not_secure_no_slash, [], true));
     $url = 'http://www.google.com/';
     $this->assertEquals($url . '?a=a', url($url_not_secure_no_slash, ['a' => 'a']));
     $url = 'https://www.google.com/';
     $this->assertEquals($url, ark_url($url));
     $this->assertEquals($url, ark_url($url, [], true));
     $this->assertEquals($url, ark_url($url, [], true, 'www.google.com'));
     $this->assertEquals($url, ark_url($url, [], true, 'www.google.com/'));
     $url_not_secure = 'http://www.google.com/';
     $this->assertEquals($url_not_secure, ark_url($url_not_secure));
     $this->assertEquals($url, ark_url($url_not_secure, [], true));
     $url_not_secure_no_slash = 'http://www.google.com';
     $this->assertEquals($url_not_secure_no_slash . '/', ark_url($url_not_secure_no_slash));
     $this->assertEquals($url, ark_url($url_not_secure_no_slash, [], true));
     $url = 'http://www.google.com/';
     $this->assertEquals($url . '?a=a', ark_url($url_not_secure_no_slash, ['a' => 'a']));
 }
Example #2
0
 /**
  * Return formatted url.
  *
  * @param string    $to
  * @param array     $params
  * @param null|bool $secure
  * @param null|bool $domain
  *
  * @return string
  */
 function url($to, $params = [], $secure = null, $domain = null)
 {
     return ark_url($to, $params, $secure, $domain);
 }