MyShaarli/tests/Url/UnparseUrlTest.php
Guillaume Virlet ef591e7ee2 Url: introduce global helper functions for cleanup and scheme detection
Relates to #314 & #326

Additions:
 - add global `cleanup_url()` and `get_url_scheme()` functions

Modifications:
 - replace `Url` usage in `index.php` by calls to global functions
 - fix `Url` tests not being run: PHPUnit expects a single test class per file
   - move classes to separate files
2015-09-08 22:00:37 +02:00

32 lines
619 B
PHP

<?php
/**
* Unpares Url's tests
*/
require_once 'application/Url.php';
/**
* Unitary tests for unparse_url()
*/
class UnparseUrlTest extends PHPUnit_Framework_TestCase
{
/**
* 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)));
}
}