X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FUrl%2FUrlTest.php;h=425327ed02b37b7f1ccb638208ddf404ed7b16d5;hb=854ea372553d6ef8174cae320801e5ff3a101a87;hp=e498d79e8ed8dbf9057ce88c04fd1e98143a5408;hpb=44d60adc5e2fa547bc49620f7e647794f0cad631;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/Url/UrlTest.php b/tests/Url/UrlTest.php index e498d79e..425327ed 100644 --- a/tests/Url/UrlTest.php +++ b/tests/Url/UrlTest.php @@ -145,4 +145,33 @@ class UrlTest extends PHPUnit_Framework_TestCase $url = new Url('git://domain.tld/push?pull=clone#checkout'); $this->assertEquals('git', $url->getScheme()); } + + /** + * Test add trailing slash. + */ + 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. + */ + function testUrlIsHttp() + { + $url = new Url(self::$baseUrl); + $this->assertTrue($url->isHttp()); + } + + /** + * Test non HTTP url. + */ + function testUrlIsNotHttp() + { + $url = new Url('ftp://save.tld/mysave'); + $this->assertFalse($url->isHttp()); + } }