From 2d9324aa8f586b931673417233c37edc98f5eb94 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Fri, 28 Aug 2015 13:30:31 +0200 Subject: [PATCH] IEUrlExtension: Add tests for the main use case the lib exists for 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 --- .../includes/libs/IEUrlExtensionTest.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/phpunit/includes/libs/IEUrlExtensionTest.php b/tests/phpunit/includes/libs/IEUrlExtensionTest.php index e96953ee12..57668e505c 100644 --- a/tests/phpunit/includes/libs/IEUrlExtensionTest.php +++ b/tests/phpunit/includes/libs/IEUrlExtensionTest.php @@ -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' + ); + } } -- 2.20.1