Index: trunk/phase3/tests/phpunit/includes/FindIE6ExtensionTest.php |
— | — | @@ -0,0 +1,102 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Tests for WebRequest::findIE6Extension |
| 6 | + */ |
| 7 | +class FindIE6ExtensionTest extends MediaWikiTestCase { |
| 8 | + function testSimple() { |
| 9 | + $this->assertEquals( |
| 10 | + WebRequest::findIE6Extension( 'x.y' ), |
| 11 | + 'y', |
| 12 | + 'Simple extension' |
| 13 | + ); |
| 14 | + } |
| 15 | + |
| 16 | + function testSimpleNoExt() { |
| 17 | + $this->assertEquals( |
| 18 | + WebRequest::findIE6Extension( 'x' ), |
| 19 | + '', |
| 20 | + 'No extension' |
| 21 | + ); |
| 22 | + } |
| 23 | + |
| 24 | + function testEmpty() { |
| 25 | + $this->assertEquals( |
| 26 | + WebRequest::findIE6Extension( '' ), |
| 27 | + '', |
| 28 | + 'Empty string' |
| 29 | + ); |
| 30 | + } |
| 31 | + |
| 32 | + function testQuestionMark() { |
| 33 | + $this->assertEquals( |
| 34 | + WebRequest::findIE6Extension( '?' ), |
| 35 | + '', |
| 36 | + 'Question mark only' |
| 37 | + ); |
| 38 | + } |
| 39 | + |
| 40 | + function testExtQuestionMark() { |
| 41 | + $this->assertEquals( |
| 42 | + WebRequest::findIE6Extension( '.x?' ), |
| 43 | + 'x', |
| 44 | + 'Extension then question mark' |
| 45 | + ); |
| 46 | + } |
| 47 | + |
| 48 | + function testQuestionMarkExt() { |
| 49 | + $this->assertEquals( |
| 50 | + WebRequest::findIE6Extension( '?.x' ), |
| 51 | + 'x', |
| 52 | + 'Question mark then extension' |
| 53 | + ); |
| 54 | + } |
| 55 | + |
| 56 | + function testInvalidChar() { |
| 57 | + $this->assertEquals( |
| 58 | + WebRequest::findIE6Extension( '.x*' ), |
| 59 | + '', |
| 60 | + 'Extension with invalid character' |
| 61 | + ); |
| 62 | + } |
| 63 | + |
| 64 | + function testMultipleQuestionMarks() { |
| 65 | + $this->assertEquals( |
| 66 | + WebRequest::findIE6Extension( 'a?b?.c?.d?e?f' ), |
| 67 | + 'c', |
| 68 | + 'Multiple question marks' |
| 69 | + ); |
| 70 | + } |
| 71 | + |
| 72 | + function testExeException() { |
| 73 | + $this->assertEquals( |
| 74 | + WebRequest::findIE6Extension( 'a?b?.exe?.d?.e' ), |
| 75 | + 'd', |
| 76 | + '.exe exception' |
| 77 | + ); |
| 78 | + } |
| 79 | + |
| 80 | + function testExeException2() { |
| 81 | + $this->assertEquals( |
| 82 | + WebRequest::findIE6Extension( 'a?b?.exe' ), |
| 83 | + 'exe', |
| 84 | + '.exe exception 2' |
| 85 | + ); |
| 86 | + } |
| 87 | + |
| 88 | + function testHash() { |
| 89 | + $this->assertEquals( |
| 90 | + WebRequest::findIE6Extension( 'a#b.c' ), |
| 91 | + '', |
| 92 | + 'Hash character preceding extension' |
| 93 | + ); |
| 94 | + } |
| 95 | + |
| 96 | + function testHash2() { |
| 97 | + $this->assertEquals( |
| 98 | + WebRequest::findIE6Extension( 'a?#b.c' ), |
| 99 | + '', |
| 100 | + 'Hash character preceding extension 2' |
| 101 | + ); |
| 102 | + } |
| 103 | +} |
Property changes on: trunk/phase3/tests/phpunit/includes/FindIE6ExtensionTest.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 104 | + native |