Tests for r88883, including two failing tests.
authorTim Starling <tstarling@users.mediawiki.org>
Tue, 31 May 2011 02:09:22 +0000 (02:09 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Tue, 31 May 2011 02:09:22 +0000 (02:09 +0000)
tests/phpunit/includes/FindIE6ExtensionTest.php [new file with mode: 0644]

diff --git a/tests/phpunit/includes/FindIE6ExtensionTest.php b/tests/phpunit/includes/FindIE6ExtensionTest.php
new file mode 100644 (file)
index 0000000..d1d5341
--- /dev/null
@@ -0,0 +1,102 @@
+<?php
+
+/**
+ * Tests for WebRequest::findIE6Extension
+ */
+class FindIE6ExtensionTest extends MediaWikiTestCase {
+       function testSimple() {
+               $this->assertEquals( 
+                       WebRequest::findIE6Extension( 'x.y' ),
+                       'y',
+                       'Simple extension'
+               );
+       }
+
+       function testSimpleNoExt() {
+               $this->assertEquals(
+                       WebRequest::findIE6Extension( 'x' ),
+                       '',
+                       'No extension'
+               );
+       }
+
+       function testEmpty() {
+               $this->assertEquals(
+                       WebRequest::findIE6Extension( '' ),
+                       '',
+                       'Empty string'
+               );
+       }
+
+       function testQuestionMark() {
+               $this->assertEquals(
+                       WebRequest::findIE6Extension( '?' ),
+                       '',
+                       'Question mark only'
+               );
+       }
+
+       function testExtQuestionMark() {
+               $this->assertEquals(
+                       WebRequest::findIE6Extension( '.x?' ),
+                       'x',
+                       'Extension then question mark'
+               );
+       }
+
+       function testQuestionMarkExt() {
+               $this->assertEquals(
+                       WebRequest::findIE6Extension( '?.x' ),
+                       'x',
+                       'Question mark then extension'
+               );
+       }
+
+       function testInvalidChar() {
+               $this->assertEquals(
+                       WebRequest::findIE6Extension( '.x*' ),
+                       '',
+                       'Extension with invalid character'
+               );
+       }
+
+       function testMultipleQuestionMarks() {
+               $this->assertEquals(
+                       WebRequest::findIE6Extension( 'a?b?.c?.d?e?f' ),
+                       'c',
+                       'Multiple question marks'
+               );
+       }
+
+       function testExeException() {
+               $this->assertEquals(
+                       WebRequest::findIE6Extension( 'a?b?.exe?.d?.e' ),
+                       'd',
+                       '.exe exception'
+               );
+       }
+
+       function testExeException2() {
+               $this->assertEquals(
+                       WebRequest::findIE6Extension( 'a?b?.exe' ),
+                       'exe',
+                       '.exe exception 2'
+               );
+       }
+
+       function testHash() {
+               $this->assertEquals(
+                       WebRequest::findIE6Extension( 'a#b.c' ),
+                       '',
+                       'Hash character preceding extension'
+               );
+       }
+
+       function testHash2() {
+               $this->assertEquals(
+                       WebRequest::findIE6Extension( 'a?#b.c' ),
+                       '',
+                       'Hash character preceding extension 2'
+               );
+       }
+}