Merge "Parse limitation warnings as 'text' and in user language"
[lhc/web/wiklou.git] / tests / phpunit / includes / libs / IEUrlExtensionTest.php
1 <?php
2
3 /**
4 * Tests for IEUrlExtension::findIE6Extension
5 */
6 class IEUrlExtensionTest extends MediaWikiTestCase {
7 function testSimple() {
8 $this->assertEquals(
9 'y',
10 IEUrlExtension::findIE6Extension( 'x.y' ),
11 'Simple extension'
12 );
13 }
14
15 function testSimpleNoExt() {
16 $this->assertEquals(
17 '',
18 IEUrlExtension::findIE6Extension( 'x' ),
19 'No extension'
20 );
21 }
22
23 function testEmpty() {
24 $this->assertEquals(
25 '',
26 IEUrlExtension::findIE6Extension( '' ),
27 'Empty string'
28 );
29 }
30
31 function testQuestionMark() {
32 $this->assertEquals(
33 '',
34 IEUrlExtension::findIE6Extension( '?' ),
35 'Question mark only'
36 );
37 }
38
39 function testExtQuestionMark() {
40 $this->assertEquals(
41 'x',
42 IEUrlExtension::findIE6Extension( '.x?' ),
43 'Extension then question mark'
44 );
45 }
46
47 function testQuestionMarkExt() {
48 $this->assertEquals(
49 'x',
50 IEUrlExtension::findIE6Extension( '?.x' ),
51 'Question mark then extension'
52 );
53 }
54
55 function testInvalidChar() {
56 $this->assertEquals(
57 '',
58 IEUrlExtension::findIE6Extension( '.x*' ),
59 'Extension with invalid character'
60 );
61 }
62
63 function testInvalidCharThenExtension() {
64 $this->assertEquals(
65 'x',
66 IEUrlExtension::findIE6Extension( '*.x' ),
67 'Invalid character followed by an extension'
68 );
69 }
70
71 function testMultipleQuestionMarks() {
72 $this->assertEquals(
73 'c',
74 IEUrlExtension::findIE6Extension( 'a?b?.c?.d?e?f' ),
75 'Multiple question marks'
76 );
77 }
78
79 function testExeException() {
80 $this->assertEquals(
81 'd',
82 IEUrlExtension::findIE6Extension( 'a?b?.exe?.d?.e' ),
83 '.exe exception'
84 );
85 }
86
87 function testExeException2() {
88 $this->assertEquals(
89 'exe',
90 IEUrlExtension::findIE6Extension( 'a?b?.exe' ),
91 '.exe exception 2'
92 );
93 }
94
95 function testHash() {
96 $this->assertEquals(
97 '',
98 IEUrlExtension::findIE6Extension( 'a#b.c' ),
99 'Hash character preceding extension'
100 );
101 }
102
103 function testHash2() {
104 $this->assertEquals(
105 '',
106 IEUrlExtension::findIE6Extension( 'a?#b.c' ),
107 'Hash character preceding extension 2'
108 );
109 }
110
111 function testDotAtEnd() {
112 $this->assertEquals(
113 '',
114 IEUrlExtension::findIE6Extension( '.' ),
115 'Dot at end of string'
116 );
117 }
118
119 function testTwoDots() {
120 $this->assertEquals(
121 'z',
122 IEUrlExtension::findIE6Extension( 'x.y.z' ),
123 'Two dots'
124 );
125 }
126 }