MediaWiki  REL1_24
IEUrlExtensionTest.php
Go to the documentation of this file.
00001 <?php
00002 
00008 class IEUrlExtensionTest extends MediaWikiTestCase {
00012     public function testSimple() {
00013         $this->assertEquals(
00014             'y',
00015             IEUrlExtension::findIE6Extension( 'x.y' ),
00016             'Simple extension'
00017         );
00018     }
00019 
00023     public function testSimpleNoExt() {
00024         $this->assertEquals(
00025             '',
00026             IEUrlExtension::findIE6Extension( 'x' ),
00027             'No extension'
00028         );
00029     }
00030 
00034     public function testEmpty() {
00035         $this->assertEquals(
00036             '',
00037             IEUrlExtension::findIE6Extension( '' ),
00038             'Empty string'
00039         );
00040     }
00041 
00045     public function testQuestionMark() {
00046         $this->assertEquals(
00047             '',
00048             IEUrlExtension::findIE6Extension( '?' ),
00049             'Question mark only'
00050         );
00051     }
00052 
00056     public function testExtQuestionMark() {
00057         $this->assertEquals(
00058             'x',
00059             IEUrlExtension::findIE6Extension( '.x?' ),
00060             'Extension then question mark'
00061         );
00062     }
00063 
00067     public function testQuestionMarkExt() {
00068         $this->assertEquals(
00069             'x',
00070             IEUrlExtension::findIE6Extension( '?.x' ),
00071             'Question mark then extension'
00072         );
00073     }
00074 
00078     public function testInvalidChar() {
00079         $this->assertEquals(
00080             '',
00081             IEUrlExtension::findIE6Extension( '.x*' ),
00082             'Extension with invalid character'
00083         );
00084     }
00085 
00089     public function testInvalidCharThenExtension() {
00090         $this->assertEquals(
00091             'x',
00092             IEUrlExtension::findIE6Extension( '*.x' ),
00093             'Invalid character followed by an extension'
00094         );
00095     }
00096 
00100     public function testMultipleQuestionMarks() {
00101         $this->assertEquals(
00102             'c',
00103             IEUrlExtension::findIE6Extension( 'a?b?.c?.d?e?f' ),
00104             'Multiple question marks'
00105         );
00106     }
00107 
00111     public function testExeException() {
00112         $this->assertEquals(
00113             'd',
00114             IEUrlExtension::findIE6Extension( 'a?b?.exe?.d?.e' ),
00115             '.exe exception'
00116         );
00117     }
00118 
00122     public function testExeException2() {
00123         $this->assertEquals(
00124             'exe',
00125             IEUrlExtension::findIE6Extension( 'a?b?.exe' ),
00126             '.exe exception 2'
00127         );
00128     }
00129 
00133     public function testHash() {
00134         $this->assertEquals(
00135             '',
00136             IEUrlExtension::findIE6Extension( 'a#b.c' ),
00137             'Hash character preceding extension'
00138         );
00139     }
00140 
00144     public function testHash2() {
00145         $this->assertEquals(
00146             '',
00147             IEUrlExtension::findIE6Extension( 'a?#b.c' ),
00148             'Hash character preceding extension 2'
00149         );
00150     }
00151 
00155     public function testDotAtEnd() {
00156         $this->assertEquals(
00157             '',
00158             IEUrlExtension::findIE6Extension( '.' ),
00159             'Dot at end of string'
00160         );
00161     }
00162 
00166     public function testTwoDots() {
00167         $this->assertEquals(
00168             'z',
00169             IEUrlExtension::findIE6Extension( 'x.y.z' ),
00170             'Two dots'
00171         );
00172     }
00173 }