+
+ /**
+ * Test add trailing slash.
+ */
+ public function testAddTrailingSlash()
+ {
+ $strOn = 'http://randomstr.com/test/';
+ $strOff = 'http://randomstr.com/test';
+ $this->assertEquals($strOn, add_trailing_slash($strOn));
+ $this->assertEquals($strOn, add_trailing_slash($strOff));
+ }
+
+ /**
+ * Test valid HTTP url.
+ */
+ public function testUrlIsHttp()
+ {
+ $url = new Url(self::$baseUrl);
+ $this->assertTrue($url->isHttp());
+ }
+
+ /**
+ * Test non HTTP url.
+ */
+ public function testUrlIsNotHttp()
+ {
+ $url = new Url('ftp://save.tld/mysave');
+ $this->assertFalse($url->isHttp());
+ }
+
+ /**
+ * Test International Domain Name to ASCII conversion
+ */
+ public function testIdnToAscii()
+ {
+ $ind = 'http://www.académie-française.fr/';
+ $expected = 'http://www.xn--acadmie-franaise-npb1a.fr/';
+ $url = new Url($ind);
+ $this->assertEquals($expected, $url->idnToAscii());
+
+ $notInd = 'http://www.academie-francaise.fr/';
+ $url = new Url($notInd);
+ $this->assertEquals($notInd, $url->idnToAscii());
+ }