2015-09-02 13:55:39 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2018-12-03 00:34:53 +01:00
|
|
|
* Unpares UrlUtils's tests
|
2015-09-02 13:55:39 +02:00
|
|
|
*/
|
|
|
|
|
2018-12-03 00:34:53 +01:00
|
|
|
namespace Shaarli\Http;
|
|
|
|
|
|
|
|
require_once 'application/http/UrlUtils.php';
|
2015-09-02 13:55:39 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Unitary tests for unparse_url()
|
|
|
|
*/
|
2018-12-03 00:34:53 +01:00
|
|
|
class UnparseUrlTest extends \PHPUnit\Framework\TestCase
|
2015-09-02 13:55:39 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Thanks for building nothing
|
|
|
|
*/
|
|
|
|
public function testUnparseEmptyArray()
|
|
|
|
{
|
|
|
|
$this->assertEquals('', unparse_url(array()));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Rebuild a full-featured URL
|
|
|
|
*/
|
|
|
|
public function testUnparseFull()
|
|
|
|
{
|
|
|
|
$ref = 'http://username:password@hostname:9090/path'
|
|
|
|
.'?arg1=value1&arg2=value2#anchor';
|
|
|
|
$this->assertEquals($ref, unparse_url(parse_url($ref)));
|
|
|
|
}
|
|
|
|
}
|