MediaWiki REL1_31
IEUrlExtensionTest.php
Go to the documentation of this file.
1<?php
2
8class IEUrlExtensionTest extends PHPUnit\Framework\TestCase {
9
10 use MediaWikiCoversValidator;
11
15 public function testSimple() {
16 $this->assertEquals(
17 'y',
19 'Simple extension'
20 );
21 }
22
26 public function testSimpleNoExt() {
27 $this->assertEquals(
28 '',
30 'No extension'
31 );
32 }
33
37 public function testEmpty() {
38 $this->assertEquals(
39 '',
41 'Empty string'
42 );
43 }
44
48 public function testQuestionMark() {
49 $this->assertEquals(
50 '',
52 'Question mark only'
53 );
54 }
55
59 public function testExtQuestionMark() {
60 $this->assertEquals(
61 'x',
63 'Extension then question mark'
64 );
65 }
66
70 public function testQuestionMarkExt() {
71 $this->assertEquals(
72 'x',
74 'Question mark then extension'
75 );
76 }
77
81 public function testInvalidChar() {
82 $this->assertEquals(
83 '',
85 'Extension with invalid character'
86 );
87 }
88
92 public function testInvalidCharThenExtension() {
93 $this->assertEquals(
94 'x',
96 'Invalid character followed by an extension'
97 );
98 }
99
103 public function testMultipleQuestionMarks() {
104 $this->assertEquals(
105 'c',
106 IEUrlExtension::findIE6Extension( 'a?b?.c?.d?e?f' ),
107 'Multiple question marks'
108 );
109 }
110
114 public function testExeException() {
115 $this->assertEquals(
116 'd',
117 IEUrlExtension::findIE6Extension( 'a?b?.exe?.d?.e' ),
118 '.exe exception'
119 );
120 }
121
125 public function testExeException2() {
126 $this->assertEquals(
127 'exe',
129 '.exe exception 2'
130 );
131 }
132
136 public function testHash() {
137 $this->assertEquals(
138 '',
140 'Hash character preceding extension'
141 );
142 }
143
147 public function testHash2() {
148 $this->assertEquals(
149 '',
151 'Hash character preceding extension 2'
152 );
153 }
154
158 public function testDotAtEnd() {
159 $this->assertEquals(
160 '',
162 'Dot at end of string'
163 );
164 }
165
169 public function testTwoDots() {
170 $this->assertEquals(
171 'z',
173 'Two dots'
174 );
175 }
176
180 public function testScriptQuery() {
181 $this->assertEquals(
182 'php',
183 IEUrlExtension::findIE6Extension( 'example.php?foo=a&bar=b' ),
184 'Script with query'
185 );
186 }
187
191 public function testEscapedScriptQuery() {
192 $this->assertEquals(
193 '',
194 IEUrlExtension::findIE6Extension( 'example%2Ephp?foo=a&bar=b' ),
195 'Script with urlencoded dot and query'
196 );
197 }
198
202 public function testEscapedScriptQueryDot() {
203 $this->assertEquals(
204 'y',
205 IEUrlExtension::findIE6Extension( 'example%2Ephp?foo=a.x&bar=b.y' ),
206 'Script with urlencoded dot and query with dot'
207 );
208 }
209}
Tests for IEUrlExtension::findIE6Extension.
testEmpty()
IEUrlExtension::findIE6Extension.
testSimple()
IEUrlExtension::findIE6Extension.
testMultipleQuestionMarks()
IEUrlExtension::findIE6Extension.
testExeException2()
IEUrlExtension::findIE6Extension.
testTwoDots()
IEUrlExtension::findIE6Extension.
testEscapedScriptQueryDot()
IEUrlExtension::findIE6Extension.
testInvalidChar()
IEUrlExtension::findIE6Extension.
testQuestionMark()
IEUrlExtension::findIE6Extension.
testExeException()
IEUrlExtension::findIE6Extension.
testScriptQuery()
IEUrlExtension::findIE6Extension.
testInvalidCharThenExtension()
IEUrlExtension::findIE6Extension.
testHash2()
IEUrlExtension::findIE6Extension.
testEscapedScriptQuery()
IEUrlExtension::findIE6Extension.
testExtQuestionMark()
IEUrlExtension::findIE6Extension.
testDotAtEnd()
IEUrlExtension::findIE6Extension.
testQuestionMarkExt()
IEUrlExtension::findIE6Extension.
testHash()
IEUrlExtension::findIE6Extension.
testSimpleNoExt()
IEUrlExtension::findIE6Extension.
static findIE6Extension( $url)
Determine what extension IE6 will infer from a certain query string.