build: Updating mediawiki/mediawiki-codesniffer to 16.0.0
[lhc/web/wiklou.git] / tests / phpunit / includes / libs / IEUrlExtensionTest.php
index d04dd7d..03c7b0c 100644 (file)
@@ -2,9 +2,17 @@
 
 /**
  * Tests for IEUrlExtension::findIE6Extension
+ * @todo tests below for findIE6Extension should be split into...
+ *    ...a dataprovider and test method.
  */
-class IEUrlExtensionTest extends MediaWikiTestCase {
-       function testSimple() {
+class IEUrlExtensionTest extends PHPUnit\Framework\TestCase {
+
+       use MediaWikiCoversValidator;
+
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
+       public function testSimple() {
                $this->assertEquals(
                        'y',
                        IEUrlExtension::findIE6Extension( 'x.y' ),
@@ -12,7 +20,10 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
-       function testSimpleNoExt() {
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
+       public function testSimpleNoExt() {
                $this->assertEquals(
                        '',
                        IEUrlExtension::findIE6Extension( 'x' ),
@@ -20,7 +31,10 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
-       function testEmpty() {
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
+       public function testEmpty() {
                $this->assertEquals(
                        '',
                        IEUrlExtension::findIE6Extension( '' ),
@@ -28,7 +42,10 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
-       function testQuestionMark() {
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
+       public function testQuestionMark() {
                $this->assertEquals(
                        '',
                        IEUrlExtension::findIE6Extension( '?' ),
@@ -36,7 +53,10 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
-       function testExtQuestionMark() {
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
+       public function testExtQuestionMark() {
                $this->assertEquals(
                        'x',
                        IEUrlExtension::findIE6Extension( '.x?' ),
@@ -44,7 +64,10 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
-       function testQuestionMarkExt() {
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
+       public function testQuestionMarkExt() {
                $this->assertEquals(
                        'x',
                        IEUrlExtension::findIE6Extension( '?.x' ),
@@ -52,7 +75,10 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
-       function testInvalidChar() {
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
+       public function testInvalidChar() {
                $this->assertEquals(
                        '',
                        IEUrlExtension::findIE6Extension( '.x*' ),
@@ -60,7 +86,10 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
-       function testInvalidCharThenExtension() {
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
+       public function testInvalidCharThenExtension() {
                $this->assertEquals(
                        'x',
                        IEUrlExtension::findIE6Extension( '*.x' ),
@@ -68,7 +97,10 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
-       function testMultipleQuestionMarks() {
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
+       public function testMultipleQuestionMarks() {
                $this->assertEquals(
                        'c',
                        IEUrlExtension::findIE6Extension( 'a?b?.c?.d?e?f' ),
@@ -76,7 +108,10 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
-       function testExeException() {
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
+       public function testExeException() {
                $this->assertEquals(
                        'd',
                        IEUrlExtension::findIE6Extension( 'a?b?.exe?.d?.e' ),
@@ -84,7 +119,10 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
-       function testExeException2() {
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
+       public function testExeException2() {
                $this->assertEquals(
                        'exe',
                        IEUrlExtension::findIE6Extension( 'a?b?.exe' ),
@@ -92,7 +130,10 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
-       function testHash() {
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
+       public function testHash() {
                $this->assertEquals(
                        '',
                        IEUrlExtension::findIE6Extension( 'a#b.c' ),
@@ -100,7 +141,10 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
-       function testHash2() {
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
+       public function testHash2() {
                $this->assertEquals(
                        '',
                        IEUrlExtension::findIE6Extension( 'a?#b.c' ),
@@ -108,7 +152,10 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
-       function testDotAtEnd() {
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
+       public function testDotAtEnd() {
                $this->assertEquals(
                        '',
                        IEUrlExtension::findIE6Extension( '.' ),
@@ -116,11 +163,47 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
-       function testTwoDots() {
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
+       public function testTwoDots() {
                $this->assertEquals(
                        'z',
                        IEUrlExtension::findIE6Extension( 'x.y.z' ),
                        'Two dots'
                );
        }
+
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
+       public function testScriptQuery() {
+               $this->assertEquals(
+                       'php',
+                       IEUrlExtension::findIE6Extension( 'example.php?foo=a&bar=b' ),
+                       'Script with query'
+               );
+       }
+
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
+       public function testEscapedScriptQuery() {
+               $this->assertEquals(
+                       '',
+                       IEUrlExtension::findIE6Extension( 'example%2Ephp?foo=a&bar=b' ),
+                       'Script with urlencoded dot and query'
+               );
+       }
+
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
+       public function testEscapedScriptQueryDot() {
+               $this->assertEquals(
+                       'y',
+                       IEUrlExtension::findIE6Extension( 'example%2Ephp?foo=a.x&bar=b.y' ),
+                       'Script with urlencoded dot and query with dot'
+               );
+       }
 }