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