4 * Tests for IEUrlExtension::findIE6Extension
6 class IEUrlExtensionTest
extends PHPUnit\Framework\TestCase
{
8 use MediaWikiCoversValidator
;
10 public function provideFindIE6Extension() {
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' ],
35 * @covers IEUrlExtension::findIE6Extension
36 * @dataProvider provideFindIE6Extension
38 public function testFindIE6Extension( $url, $expected, $message ) {
41 IEUrlExtension
::findIE6Extension( $url ),