2015-09-02 13:55:39 +02:00
|
|
|
<?php
|
2021-04-05 09:39:34 +02:00
|
|
|
|
2015-09-02 13:55:39 +02:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
2021-04-05 11:00:28 +02:00
|
|
|
use Shaarli\TestCase;
|
2018-12-03 00:34:53 +01:00
|
|
|
|
2021-04-05 11:00:28 +02:00
|
|
|
class GetUrlSchemeTest extends 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'));
|
|
|
|
}
|
|
|
|
}
|