blob: 61264ac50e53e297514b98f8a130558b69ecb787 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
<?php
require_once dirname(__FILE__) . '/../functions.php';
/**
* Unit tests for functions.php
*
* @author Christian Weiske <[email protected]>
*/
class FunctionsTest extends PHPUnit_Framework_TestCase
{
/**
* Test fix_url with feed:// urls
*/
public function testFixUrlFeed()
{
$this->assertEquals('http://tt-rss.org/', fix_url('feed://tt-rss.org'));
$this->assertEquals('http://tt-rss.org/', fix_url('feed://tt-rss.org/'));
}
/**
* Test fix_url with non-http protocols
*/
public function testFixUrlProtocols()
{
$this->assertEquals('https://tt-rss.org/', fix_url('https://tt-rss.org'));
$this->assertEquals('ftp://tt-rss.org/', fix_url('ftp://tt-rss.org/'));
$this->assertEquals(
'reallylongprotocolisthat://tt-rss.org/',
fix_url('reallylongprotocolisthat://tt-rss.org')
);
}
/**
* Test fix_url with domain names only
*/
public function testFixUrlDomainOnly()
{
$this->assertEquals('http://tt-rss.org/', fix_url('tt-rss.org'));
$this->assertEquals('http://tt-rss.org/', fix_url('tt-rss.org/'));
$this->assertEquals('http://tt-rss.org/', fix_url('http://tt-rss.org'));
$this->assertEquals('http://tt-rss.org/', fix_url('http://tt-rss.org/'));
}
/**
* Test fix_url with domain + paths
*/
public function testFixUrlWithPaths()
{
$this->assertEquals('http://tt-rss.org/foo', fix_url('tt-rss.org/foo'));
$this->assertEquals(
'http://tt-rss.org/foo/bar/baz',
fix_url('tt-rss.org/foo/bar/baz')
);
$this->assertEquals(
'http://tt-rss.org/foo/bar/baz/',
fix_url('tt-rss.org/foo/bar/baz/')
);
}
}
?>
|