2011-05-31 02:09:22 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
2011-06-06 11:59:20 +00:00
|
|
|
* Tests for IEUrlExtension::findIE6Extension
|
2013-10-24 16:45:52 +00:00
|
|
|
* @todo tests below for findIE6Extension should be split into...
|
|
|
|
|
* ...a dataprovider and test method.
|
2011-05-31 02:09:22 +00:00
|
|
|
*/
|
2014-12-30 04:53:24 +00:00
|
|
|
class IEUrlExtensionTest extends PHPUnit_Framework_TestCase {
|
2013-10-24 16:45:52 +00:00
|
|
|
/**
|
|
|
|
|
* @covers IEUrlExtension::findIE6Extension
|
|
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testSimple() {
|
2013-02-15 10:17:52 +00:00
|
|
|
$this->assertEquals(
|
2011-05-31 02:09:22 +00:00
|
|
|
'y',
|
2011-06-06 11:59:20 +00:00
|
|
|
IEUrlExtension::findIE6Extension( 'x.y' ),
|
2011-05-31 02:09:22 +00:00
|
|
|
'Simple extension'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-24 16:45:52 +00:00
|
|
|
/**
|
|
|
|
|
* @covers IEUrlExtension::findIE6Extension
|
|
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testSimpleNoExt() {
|
2011-05-31 02:09:22 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
|
'',
|
2011-06-06 11:59:20 +00:00
|
|
|
IEUrlExtension::findIE6Extension( 'x' ),
|
2011-05-31 02:09:22 +00:00
|
|
|
'No extension'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-24 16:45:52 +00:00
|
|
|
/**
|
|
|
|
|
* @covers IEUrlExtension::findIE6Extension
|
|
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testEmpty() {
|
2011-05-31 02:09:22 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
|
'',
|
2011-06-06 11:59:20 +00:00
|
|
|
IEUrlExtension::findIE6Extension( '' ),
|
2011-05-31 02:09:22 +00:00
|
|
|
'Empty string'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-24 16:45:52 +00:00
|
|
|
/**
|
|
|
|
|
* @covers IEUrlExtension::findIE6Extension
|
|
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testQuestionMark() {
|
2011-05-31 02:09:22 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
|
'',
|
2011-06-06 11:59:20 +00:00
|
|
|
IEUrlExtension::findIE6Extension( '?' ),
|
2011-05-31 02:09:22 +00:00
|
|
|
'Question mark only'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-24 16:45:52 +00:00
|
|
|
/**
|
|
|
|
|
* @covers IEUrlExtension::findIE6Extension
|
|
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testExtQuestionMark() {
|
2011-05-31 02:09:22 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
|
'x',
|
2011-06-06 11:59:20 +00:00
|
|
|
IEUrlExtension::findIE6Extension( '.x?' ),
|
2011-05-31 02:09:22 +00:00
|
|
|
'Extension then question mark'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-24 16:45:52 +00:00
|
|
|
/**
|
|
|
|
|
* @covers IEUrlExtension::findIE6Extension
|
|
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testQuestionMarkExt() {
|
2011-05-31 02:09:22 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
|
'x',
|
2011-06-06 11:59:20 +00:00
|
|
|
IEUrlExtension::findIE6Extension( '?.x' ),
|
2011-05-31 02:09:22 +00:00
|
|
|
'Question mark then extension'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-24 16:45:52 +00:00
|
|
|
/**
|
|
|
|
|
* @covers IEUrlExtension::findIE6Extension
|
|
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testInvalidChar() {
|
2011-05-31 02:09:22 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
|
'',
|
2011-06-06 11:59:20 +00:00
|
|
|
IEUrlExtension::findIE6Extension( '.x*' ),
|
2011-05-31 02:09:22 +00:00
|
|
|
'Extension with invalid character'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-24 16:45:52 +00:00
|
|
|
/**
|
|
|
|
|
* @covers IEUrlExtension::findIE6Extension
|
|
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testInvalidCharThenExtension() {
|
2011-06-01 00:51:09 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
|
'x',
|
2011-06-06 11:59:20 +00:00
|
|
|
IEUrlExtension::findIE6Extension( '*.x' ),
|
2011-06-01 00:51:09 +00:00
|
|
|
'Invalid character followed by an extension'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-24 16:45:52 +00:00
|
|
|
/**
|
|
|
|
|
* @covers IEUrlExtension::findIE6Extension
|
|
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testMultipleQuestionMarks() {
|
2011-05-31 02:09:22 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
|
'c',
|
2011-06-06 11:59:20 +00:00
|
|
|
IEUrlExtension::findIE6Extension( 'a?b?.c?.d?e?f' ),
|
2011-05-31 02:09:22 +00:00
|
|
|
'Multiple question marks'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-24 16:45:52 +00:00
|
|
|
/**
|
|
|
|
|
* @covers IEUrlExtension::findIE6Extension
|
|
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testExeException() {
|
2011-05-31 02:09:22 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
|
'd',
|
2011-06-06 11:59:20 +00:00
|
|
|
IEUrlExtension::findIE6Extension( 'a?b?.exe?.d?.e' ),
|
2011-05-31 02:09:22 +00:00
|
|
|
'.exe exception'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-24 16:45:52 +00:00
|
|
|
/**
|
|
|
|
|
* @covers IEUrlExtension::findIE6Extension
|
|
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testExeException2() {
|
2011-05-31 02:09:22 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
|
'exe',
|
2011-06-06 11:59:20 +00:00
|
|
|
IEUrlExtension::findIE6Extension( 'a?b?.exe' ),
|
2011-05-31 02:09:22 +00:00
|
|
|
'.exe exception 2'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-24 16:45:52 +00:00
|
|
|
/**
|
|
|
|
|
* @covers IEUrlExtension::findIE6Extension
|
|
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testHash() {
|
2011-05-31 02:09:22 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
|
'',
|
2011-06-06 11:59:20 +00:00
|
|
|
IEUrlExtension::findIE6Extension( 'a#b.c' ),
|
2011-05-31 02:09:22 +00:00
|
|
|
'Hash character preceding extension'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-24 16:45:52 +00:00
|
|
|
/**
|
|
|
|
|
* @covers IEUrlExtension::findIE6Extension
|
|
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testHash2() {
|
2011-05-31 02:09:22 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
|
'',
|
2011-06-06 11:59:20 +00:00
|
|
|
IEUrlExtension::findIE6Extension( 'a?#b.c' ),
|
2011-05-31 02:09:22 +00:00
|
|
|
'Hash character preceding extension 2'
|
|
|
|
|
);
|
|
|
|
|
}
|
2011-06-01 00:51:09 +00:00
|
|
|
|
2013-10-24 16:45:52 +00:00
|
|
|
/**
|
|
|
|
|
* @covers IEUrlExtension::findIE6Extension
|
|
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testDotAtEnd() {
|
2011-06-01 00:51:09 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
|
'',
|
2011-06-06 11:59:20 +00:00
|
|
|
IEUrlExtension::findIE6Extension( '.' ),
|
2011-06-01 00:51:09 +00:00
|
|
|
'Dot at end of string'
|
|
|
|
|
);
|
|
|
|
|
}
|
2013-08-14 16:31:05 +00:00
|
|
|
|
2013-10-24 16:45:52 +00:00
|
|
|
/**
|
|
|
|
|
* @covers IEUrlExtension::findIE6Extension
|
|
|
|
|
*/
|
2013-10-23 22:51:31 +00:00
|
|
|
public function testTwoDots() {
|
2013-08-14 16:31:05 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
|
'z',
|
|
|
|
|
IEUrlExtension::findIE6Extension( 'x.y.z' ),
|
|
|
|
|
'Two dots'
|
|
|
|
|
);
|
|
|
|
|
}
|
2015-08-28 11:30:31 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @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'
|
|
|
|
|
);
|
|
|
|
|
}
|
2011-05-31 02:09:22 +00:00
|
|
|
}
|