2015-09-02 13:55:39 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Unitary tests for get_url_scheme()
|
|
|
|
*/
|
|
|
|
|
2018-12-03 00:34:53 +01:00
|
|
|
namespace Shaarli\Http;
|
2015-09-02 13:55:39 +02:00
|
|
|
|
2018-12-03 00:34:53 +01:00
|
|
|
require_once 'application/http/UrlUtils.php';
|
|
|
|
|
|
|
|
class GetUrlSchemeTest extends \PHPUnit\Framework\TestCase
|
2015-09-02 13:55:39 +02:00
|
|
|
{
|
|
|
|
/**
|
2018-12-03 00:34:53 +01:00
|
|
|
* Get empty scheme string for empty UrlUtils
|
2015-09-02 13:55:39 +02:00
|
|
|
*/
|
|
|
|
public function testGetUrlSchemeEmpty()
|
|
|
|
{
|
|
|
|
$this->assertEquals('', get_url_scheme(''));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-12-03 00:34:53 +01:00
|
|
|
* Get normal scheme of UrlUtils
|
2015-09-02 13:55:39 +02:00
|
|
|
*/
|
|
|
|
public function testGetUrlScheme()
|
|
|
|
{
|
|
|
|
$this->assertEquals('http', get_url_scheme('http://domain.tld:3000'));
|
|
|
|
$this->assertEquals('https', get_url_scheme('https://domain.tld:3000'));
|
|
|
|
$this->assertEquals('http', get_url_scheme('domain.tld'));
|
|
|
|
$this->assertEquals('ssh', get_url_scheme('ssh://domain.tld'));
|
|
|
|
$this->assertEquals('ftp', get_url_scheme('ftp://domain.tld'));
|
|
|
|
$this->assertEquals('git', get_url_scheme('git://domain.tld/push?pull=clone#checkout'));
|
|
|
|
}
|
|
|
|
}
|