IEUrlExtension: Add tests for the main use case the lib exists for
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 28 Aug 2015 11:30:31 +0000 (13:30 +0200)
committerTimo Tijhof <krinklemail@gmail.com>
Fri, 28 Aug 2015 11:30:31 +0000 (13:30 +0200)
There are plenty of tests for the basic behaviour of the extension
detector and how IE favours the extension from the first question mark
segment that has a dot in the next segment.

But it was missing a test for the main use case the library exists
for, which is extensions in query strings when there is a file name
with extension already (but the dot is urlencoded).

Change-Id: I0f2e1387ae42da68020f1d793bb9eb5a87a06f24

tests/phpunit/includes/libs/IEUrlExtensionTest.php

index e96953e..57668e5 100644 (file)
@@ -170,4 +170,37 @@ class IEUrlExtensionTest extends PHPUnit_Framework_TestCase {
                        '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'
+               );
+       }
 }