MediaWiki REL1_32
IEUrlExtensionTest.php
Go to the documentation of this file.
1<?php
2
6class IEUrlExtensionTest extends PHPUnit\Framework\TestCase {
7
8 use MediaWikiCoversValidator;
9
10 public function provideFindIE6Extension() {
11 return [
12 // url, expected, message
13 [ 'x.y', 'y', 'Simple extension' ],
14 [ 'x', '', 'No extension' ],
15 [ '', '', 'Empty string' ],
16 [ '?', '', 'Question mark only' ],
17 [ '.x?', 'x', 'Extension then question mark' ],
18 [ '?.x', 'x', 'Question mark then extension' ],
19 [ '.x*', '', 'Extension with invalid character' ],
20 [ '*.x', 'x', 'Invalid character followed by an extension' ],
21 [ 'a?b?.c?.d?e?f', 'c', 'Multiple question marks' ],
22 [ 'a?b?.exe?.d?.e', 'd', '.exe exception' ],
23 [ 'a?b?.exe', 'exe', '.exe exception 2' ],
24 [ 'a#b.c', '', 'Hash character preceding extension' ],
25 [ 'a?#b.c', '', 'Hash character preceding extension 2' ],
26 [ '.', '', 'Dot at end of string' ],
27 [ 'x.y.z', 'z', 'Two dots' ],
28 [ 'example.php?foo=a&bar=b', 'php', 'Script with query' ],
29 [ 'example%2Ephp?foo=a&bar=b', '', 'Script with urlencoded dot and query' ],
30 [ 'example%2Ephp?foo=a.x&bar=b.y', 'y', 'Script with urlencoded dot and query with dot' ],
31 ];
32 }
33
38 public function testFindIE6Extension( $url, $expected, $message ) {
39 $this->assertEquals(
40 $expected,
42 $message
43 );
44 }
45}
Tests for IEUrlExtension::findIE6Extension.
testFindIE6Extension( $url, $expected, $message)
IEUrlExtension::findIE6Extension provideFindIE6Extension.
static findIE6Extension( $url)
Determine what extension IE6 will infer from a certain query string.