diff options
author | Guillaume Virlet <github@virlet.org> | 2015-09-02 13:55:39 +0200 |
---|---|---|
committer | Guillaume Virlet <github@virlet.org> | 2015-09-08 22:00:37 +0200 |
commit | ef591e7ee21435da9314c5f7f6ea983c6f423898 (patch) | |
tree | a58c1bcaab33d42161b23d55c739737526ea17e9 /tests/Url/UnparseUrlTest.php | |
parent | 0a813cfd7cdf3c81faba8568bf6e2e667aae6f13 (diff) | |
download | Shaarli-ef591e7ee21435da9314c5f7f6ea983c6f423898.tar.gz Shaarli-ef591e7ee21435da9314c5f7f6ea983c6f423898.tar.zst Shaarli-ef591e7ee21435da9314c5f7f6ea983c6f423898.zip |
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
Diffstat (limited to 'tests/Url/UnparseUrlTest.php')
-rw-r--r-- | tests/Url/UnparseUrlTest.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/Url/UnparseUrlTest.php b/tests/Url/UnparseUrlTest.php new file mode 100644 index 00000000..edde73e4 --- /dev/null +++ b/tests/Url/UnparseUrlTest.php | |||
@@ -0,0 +1,31 @@ | |||
1 | <?php | ||
2 | /** | ||
3 | * Unpares Url's tests | ||
4 | */ | ||
5 | |||
6 | require_once 'application/Url.php'; | ||
7 | |||
8 | /** | ||
9 | * Unitary tests for unparse_url() | ||
10 | */ | ||
11 | class UnparseUrlTest extends PHPUnit_Framework_TestCase | ||
12 | { | ||
13 | /** | ||
14 | * Thanks for building nothing | ||
15 | */ | ||
16 | public function testUnparseEmptyArray() | ||
17 | { | ||
18 | $this->assertEquals('', unparse_url(array())); | ||
19 | } | ||
20 | |||
21 | /** | ||
22 | * Rebuild a full-featured URL | ||
23 | */ | ||
24 | public function testUnparseFull() | ||
25 | { | ||
26 | $ref = 'http://username:password@hostname:9090/path' | ||
27 | .'?arg1=value1&arg2=value2#anchor'; | ||
28 | $this->assertEquals($ref, unparse_url(parse_url($ref))); | ||
29 | } | ||
30 | } | ||
31 | |||