Merge "Update docs/hooks.txt for ShowSearchHitTitle"
[mediawiki.git] / tests / phpunit / includes / libs / IEUrlExtensionTest.php
blob57668e505c4e72e6b885925dbd76a63a5ecf7907
1 <?php
3 /**
4 * Tests for IEUrlExtension::findIE6Extension
5 * @todo tests below for findIE6Extension should be split into...
6 * ...a dataprovider and test method.
7 */
8 class IEUrlExtensionTest extends PHPUnit_Framework_TestCase {
9 /**
10 * @covers IEUrlExtension::findIE6Extension
12 public function testSimple() {
13 $this->assertEquals(
14 'y',
15 IEUrlExtension::findIE6Extension( 'x.y' ),
16 'Simple extension'
20 /**
21 * @covers IEUrlExtension::findIE6Extension
23 public function testSimpleNoExt() {
24 $this->assertEquals(
25 '',
26 IEUrlExtension::findIE6Extension( 'x' ),
27 'No extension'
31 /**
32 * @covers IEUrlExtension::findIE6Extension
34 public function testEmpty() {
35 $this->assertEquals(
36 '',
37 IEUrlExtension::findIE6Extension( '' ),
38 'Empty string'
42 /**
43 * @covers IEUrlExtension::findIE6Extension
45 public function testQuestionMark() {
46 $this->assertEquals(
47 '',
48 IEUrlExtension::findIE6Extension( '?' ),
49 'Question mark only'
53 /**
54 * @covers IEUrlExtension::findIE6Extension
56 public function testExtQuestionMark() {
57 $this->assertEquals(
58 'x',
59 IEUrlExtension::findIE6Extension( '.x?' ),
60 'Extension then question mark'
64 /**
65 * @covers IEUrlExtension::findIE6Extension
67 public function testQuestionMarkExt() {
68 $this->assertEquals(
69 'x',
70 IEUrlExtension::findIE6Extension( '?.x' ),
71 'Question mark then extension'
75 /**
76 * @covers IEUrlExtension::findIE6Extension
78 public function testInvalidChar() {
79 $this->assertEquals(
80 '',
81 IEUrlExtension::findIE6Extension( '.x*' ),
82 'Extension with invalid character'
86 /**
87 * @covers IEUrlExtension::findIE6Extension
89 public function testInvalidCharThenExtension() {
90 $this->assertEquals(
91 'x',
92 IEUrlExtension::findIE6Extension( '*.x' ),
93 'Invalid character followed by an extension'
97 /**
98 * @covers IEUrlExtension::findIE6Extension
100 public function testMultipleQuestionMarks() {
101 $this->assertEquals(
102 'c',
103 IEUrlExtension::findIE6Extension( 'a?b?.c?.d?e?f' ),
104 'Multiple question marks'
109 * @covers IEUrlExtension::findIE6Extension
111 public function testExeException() {
112 $this->assertEquals(
113 'd',
114 IEUrlExtension::findIE6Extension( 'a?b?.exe?.d?.e' ),
115 '.exe exception'
120 * @covers IEUrlExtension::findIE6Extension
122 public function testExeException2() {
123 $this->assertEquals(
124 'exe',
125 IEUrlExtension::findIE6Extension( 'a?b?.exe' ),
126 '.exe exception 2'
131 * @covers IEUrlExtension::findIE6Extension
133 public function testHash() {
134 $this->assertEquals(
136 IEUrlExtension::findIE6Extension( 'a#b.c' ),
137 'Hash character preceding extension'
142 * @covers IEUrlExtension::findIE6Extension
144 public function testHash2() {
145 $this->assertEquals(
147 IEUrlExtension::findIE6Extension( 'a?#b.c' ),
148 'Hash character preceding extension 2'
153 * @covers IEUrlExtension::findIE6Extension
155 public function testDotAtEnd() {
156 $this->assertEquals(
158 IEUrlExtension::findIE6Extension( '.' ),
159 'Dot at end of string'
164 * @covers IEUrlExtension::findIE6Extension
166 public function testTwoDots() {
167 $this->assertEquals(
168 'z',
169 IEUrlExtension::findIE6Extension( 'x.y.z' ),
170 'Two dots'
175 * @covers IEUrlExtension::findIE6Extension
177 public function testScriptQuery() {
178 $this->assertEquals(
179 'php',
180 IEUrlExtension::findIE6Extension( 'example.php?foo=a&bar=b' ),
181 'Script with query'
186 * @covers IEUrlExtension::findIE6Extension
188 public function testEscapedScriptQuery() {
189 $this->assertEquals(
191 IEUrlExtension::findIE6Extension( 'example%2Ephp?foo=a&bar=b' ),
192 'Script with urlencoded dot and query'
197 * @covers IEUrlExtension::findIE6Extension
199 public function testEscapedScriptQueryDot() {
200 $this->assertEquals(
201 'y',
202 IEUrlExtension::findIE6Extension( 'example%2Ephp?foo=a.x&bar=b.y' ),
203 'Script with urlencoded dot and query with dot'