summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/libs
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-12-08 09:55:49 +0100
committerPierre Schmitz <pierre@archlinux.de>2013-12-08 09:55:49 +0100
commit4ac9fa081a7c045f6a9f1cfc529d82423f485b2e (patch)
treeaf68743f2f4a47d13f2b0eb05f5c4aaf86d8ea37 /tests/phpunit/includes/libs
parentaf4da56f1ad4d3ef7b06557bae365da2ea27a897 (diff)
Update to MediaWiki 1.22.0
Diffstat (limited to 'tests/phpunit/includes/libs')
-rw-r--r--tests/phpunit/includes/libs/CSSJanusTest.php72
-rw-r--r--tests/phpunit/includes/libs/CSSMinTest.php12
-rw-r--r--tests/phpunit/includes/libs/GenericArrayObjectTest.php3
-rw-r--r--tests/phpunit/includes/libs/IEUrlExtensionTest.php30
-rw-r--r--tests/phpunit/includes/libs/JavaScriptMinifierTest.php8
5 files changed, 86 insertions, 39 deletions
diff --git a/tests/phpunit/includes/libs/CSSJanusTest.php b/tests/phpunit/includes/libs/CSSJanusTest.php
index 26747b91..5a3c1619 100644
--- a/tests/phpunit/includes/libs/CSSJanusTest.php
+++ b/tests/phpunit/includes/libs/CSSJanusTest.php
@@ -4,12 +4,14 @@
* CSSJanus libary:
* http://code.google.com/p/cssjanus/source/browse/trunk/cssjanus_test.py
* Ported to PHP for ResourceLoader and has been extended since.
+ *
+ * @covers CSSJanus
*/
class CSSJanusTest extends MediaWikiTestCase {
/**
* @dataProvider provideTransformCases
*/
- function testTransform( $cssA, $cssB = null ) {
+ public function testTransform( $cssA, $cssB = null ) {
if ( $cssB ) {
$transformedA = CSSJanus::transform( $cssA );
@@ -28,7 +30,7 @@ class CSSJanusTest extends MediaWikiTestCase {
/**
* @dataProvider provideTransformAdvancedCases
*/
- function testTransformAdvanced( $code, $expectedOutput, $options = array() ) {
+ public function testTransformAdvanced( $code, $expectedOutput, $options = array() ) {
$swapLtrRtlInURL = isset( $options['swapLtrRtlInURL'] ) ? $options['swapLtrRtlInURL'] : false;
$swapLeftRightInURL = isset( $options['swapLeftRightInURL'] ) ? $options['swapLeftRightInURL'] : false;
@@ -44,7 +46,7 @@ class CSSJanusTest extends MediaWikiTestCase {
* @dataProvider provideTransformBrokenCases
* @group Broken
*/
- function testTransformBroken( $code, $expectedOutput ) {
+ public function testTransformBroken( $code, $expectedOutput ) {
$flipped = CSSJanus::transform( $code );
$this->assertEquals( $expectedOutput, $flipped, 'Test flipping' );
@@ -54,7 +56,7 @@ class CSSJanusTest extends MediaWikiTestCase {
* These transform cases are tested *in both directions*
* No need to declare a principle twice in both directions here.
*/
- function provideTransformCases() {
+ public static function provideTransformCases() {
return array(
// Property keys
array(
@@ -137,11 +139,16 @@ class CSSJanusTest extends MediaWikiTestCase {
'.foo { padding: 1px inherit 3px auto; }',
'.foo { padding: 1px auto 3px inherit; }'
),
+ // border-radius assigns different meanings to the values
array(
'.foo { border-radius: .25em 15px 0pt 0ex; }',
- '.foo { border-radius: .25em 0ex 0pt 15px; }'
+ '.foo { border-radius: 15px .25em 0ex 0pt; }'
),
array(
+ '.foo { border-radius: 0px 0px 5px 5px; }',
+ ),
+ // Ensure the rule doesn't break other stuff
+ array(
'.foo { x-unknown: a b c d; }'
),
array(
@@ -151,14 +158,26 @@ class CSSJanusTest extends MediaWikiTestCase {
'#settings td p strong'
),
array(
- # Not sure how 4+ values should behave,
- # testing to make sure changes are detected
- '.foo { x-unknown: 1 2 3 4 5; }',
- '.foo { x-unknown: 1 4 3 2 5; }',
+ // Color names
+ '.foo { border-color: red green blue white }',
+ '.foo { border-color: red white blue green }',
+ ),
+ array(
+ // Color name, hexdecimal, RGB & RGBA
+ '.foo { border-color: red #f00 rgb(255, 0, 0) rgba(255, 0, 0, 0.5) }',
+ '.foo { border-color: red rgba(255, 0, 0, 0.5) rgb(255, 0, 0) #f00 }',
+ ),
+ array(
+ // Color name, hexdecimal, HSL & HSLA
+ '.foo { border-color: red #f00 hsl(0, 100%, 50%) hsla(0, 100%, 50%, 0.5) }',
+ '.foo { border-color: red hsla(0, 100%, 50%, 0.5) hsl(0, 100%, 50%) #f00 }',
),
array(
- '.foo { x-unknown: 1 2 3 4 5 6; }',
- '.foo { x-unknown: 1 4 3 2 5 6; }',
+ // Do not mangle 5 or more values
+ '.foo { -x-unknown: 1 2 3 4 5; }'
+ ),
+ array(
+ '.foo { -x-unknown: 1 2 3 4 5 6; }'
),
// Shorthand / Three notation
@@ -179,6 +198,28 @@ class CSSJanusTest extends MediaWikiTestCase {
'.foo { padding: 1px; }'
),
+ // text-shadow and box-shadow
+ array(
+ '.foo { box-shadow: -6px 3px 8px 5px rgba(0, 0, 0, 0.25); }',
+ '.foo { box-shadow: 6px 3px 8px 5px rgba(0, 0, 0, 0.25); }',
+ ),
+ array(
+ '.foo { box-shadow: inset -6px 3px 8px 5px rgba(0, 0, 0, 0.25); }',
+ '.foo { box-shadow: inset 6px 3px 8px 5px rgba(0, 0, 0, 0.25); }',
+ ),
+ array(
+ '.foo { text-shadow: orange 2px 0; }',
+ '.foo { text-shadow: orange -2px 0; }',
+ ),
+ array(
+ '.foo { text-shadow: 2px 0 orange; }',
+ '.foo { text-shadow: -2px 0 orange; }',
+ ),
+ array(
+ // Don't mangle zeroes
+ '.foo { text-shadow: orange 0 2px; }'
+ ),
+
// Direction
// Note: This differs from the Python implementation,
// see also CSSJanus::fixDirection for more info.
@@ -377,6 +418,11 @@ class CSSJanusTest extends MediaWikiTestCase {
'/* @noflip */ div { float: left; } .foo { float: right; }'
),
array(
+ // support parentheses in selector
+ '/* @noflip */ .test:not(:first) { margin-right: -0.25em; margin-left: 0.25em; }',
+ '/* @noflip */ .test:not(:first) { margin-right: -0.25em; margin-left: 0.25em; }'
+ ),
+ array(
// after multiple rules
'.foo { float: left; } /* @noflip */ div { float: left; }',
'.foo { float: right; } /* @noflip */ div { float: left; }'
@@ -476,7 +522,7 @@ class CSSJanusTest extends MediaWikiTestCase {
* If both ways can be tested, either put both versions in here or move
* it to provideTransformCases().
*/
- function provideTransformAdvancedCases() {
+ public static function provideTransformAdvancedCases() {
$bgPairs = array(
# [ - _ . ] <-> [ left right ltr rtl ]
'foo.jpg' => 'foo.jpg',
@@ -542,7 +588,7 @@ class CSSJanusTest extends MediaWikiTestCase {
* Cases that are currently failing, but
* should be looked at in the future as enhancements and/or bug fix
*/
- function provideTransformBrokenCases() {
+ public static function provideTransformBrokenCases() {
return array(
// Guard against selectors that look flippable
array(
diff --git a/tests/phpunit/includes/libs/CSSMinTest.php b/tests/phpunit/includes/libs/CSSMinTest.php
index 57017a84..951dd7b9 100644
--- a/tests/phpunit/includes/libs/CSSMinTest.php
+++ b/tests/phpunit/includes/libs/CSSMinTest.php
@@ -21,13 +21,13 @@ class CSSMinTest extends MediaWikiTestCase {
/**
* @dataProvider provideMinifyCases
*/
- function testMinify( $code, $expectedOutput ) {
+ public function testMinify( $code, $expectedOutput ) {
$minified = CSSMin::minify( $code );
$this->assertEquals( $expectedOutput, $minified, 'Minified output should be in the form expected.' );
}
- function provideMinifyCases() {
+ public static function provideMinifyCases() {
return array(
// Whitespace
array( "\r\t\f \v\n\r", "" ),
@@ -70,14 +70,14 @@ class CSSMinTest extends MediaWikiTestCase {
/**
* @dataProvider provideRemapCases
*/
- function testRemap( $message, $params, $expectedOutput ) {
+ public function testRemap( $message, $params, $expectedOutput ) {
$remapped = call_user_func_array( 'CSSMin::remap', $params );
$messageAdd = " Case: $message";
$this->assertEquals( $expectedOutput, $remapped, 'CSSMin::remap should return the expected url form.' . $messageAdd );
}
- function provideRemapCases() {
+ public static function provideRemapCases() {
// Parameter signature:
// CSSMin::remap( $code, $local, $remote, $embedData = true )
return array(
@@ -115,11 +115,11 @@ class CSSMinTest extends MediaWikiTestCase {
* @group Broken
* @dataProvider provideStringCases
*/
- function testMinifyWithCSSStringValues( $code, $expectedOutput ) {
+ public function testMinifyWithCSSStringValues( $code, $expectedOutput ) {
$this->testMinifyOutput( $code, $expectedOutput );
}
- function provideStringCases() {
+ public static function provideStringCases() {
return array(
// String values should be respected
// - More than one space in a string value
diff --git a/tests/phpunit/includes/libs/GenericArrayObjectTest.php b/tests/phpunit/includes/libs/GenericArrayObjectTest.php
index 37a9b347..7436c43c 100644
--- a/tests/phpunit/includes/libs/GenericArrayObjectTest.php
+++ b/tests/phpunit/includes/libs/GenericArrayObjectTest.php
@@ -73,6 +73,7 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
*/
protected function getNew( array $elements = array() ) {
$class = $this->getInstanceClass();
+
return new $class( $elements );
}
@@ -197,6 +198,7 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
public function testOffsetSet( array $elements ) {
if ( $elements === array() ) {
$this->assertTrue( true );
+
return;
}
@@ -258,5 +260,4 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
$this->assertArrayEquals( $list, $copy, true, true );
}
-
}
diff --git a/tests/phpunit/includes/libs/IEUrlExtensionTest.php b/tests/phpunit/includes/libs/IEUrlExtensionTest.php
index d04dd7d4..66fe915a 100644
--- a/tests/phpunit/includes/libs/IEUrlExtensionTest.php
+++ b/tests/phpunit/includes/libs/IEUrlExtensionTest.php
@@ -4,7 +4,7 @@
* Tests for IEUrlExtension::findIE6Extension
*/
class IEUrlExtensionTest extends MediaWikiTestCase {
- function testSimple() {
+ public function testSimple() {
$this->assertEquals(
'y',
IEUrlExtension::findIE6Extension( 'x.y' ),
@@ -12,7 +12,7 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
);
}
- function testSimpleNoExt() {
+ public function testSimpleNoExt() {
$this->assertEquals(
'',
IEUrlExtension::findIE6Extension( 'x' ),
@@ -20,7 +20,7 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
);
}
- function testEmpty() {
+ public function testEmpty() {
$this->assertEquals(
'',
IEUrlExtension::findIE6Extension( '' ),
@@ -28,7 +28,7 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
);
}
- function testQuestionMark() {
+ public function testQuestionMark() {
$this->assertEquals(
'',
IEUrlExtension::findIE6Extension( '?' ),
@@ -36,7 +36,7 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
);
}
- function testExtQuestionMark() {
+ public function testExtQuestionMark() {
$this->assertEquals(
'x',
IEUrlExtension::findIE6Extension( '.x?' ),
@@ -44,7 +44,7 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
);
}
- function testQuestionMarkExt() {
+ public function testQuestionMarkExt() {
$this->assertEquals(
'x',
IEUrlExtension::findIE6Extension( '?.x' ),
@@ -52,7 +52,7 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
);
}
- function testInvalidChar() {
+ public function testInvalidChar() {
$this->assertEquals(
'',
IEUrlExtension::findIE6Extension( '.x*' ),
@@ -60,7 +60,7 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
);
}
- function testInvalidCharThenExtension() {
+ public function testInvalidCharThenExtension() {
$this->assertEquals(
'x',
IEUrlExtension::findIE6Extension( '*.x' ),
@@ -68,7 +68,7 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
);
}
- function testMultipleQuestionMarks() {
+ public function testMultipleQuestionMarks() {
$this->assertEquals(
'c',
IEUrlExtension::findIE6Extension( 'a?b?.c?.d?e?f' ),
@@ -76,7 +76,7 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
);
}
- function testExeException() {
+ public function testExeException() {
$this->assertEquals(
'd',
IEUrlExtension::findIE6Extension( 'a?b?.exe?.d?.e' ),
@@ -84,7 +84,7 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
);
}
- function testExeException2() {
+ public function testExeException2() {
$this->assertEquals(
'exe',
IEUrlExtension::findIE6Extension( 'a?b?.exe' ),
@@ -92,7 +92,7 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
);
}
- function testHash() {
+ public function testHash() {
$this->assertEquals(
'',
IEUrlExtension::findIE6Extension( 'a#b.c' ),
@@ -100,7 +100,7 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
);
}
- function testHash2() {
+ public function testHash2() {
$this->assertEquals(
'',
IEUrlExtension::findIE6Extension( 'a?#b.c' ),
@@ -108,7 +108,7 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
);
}
- function testDotAtEnd() {
+ public function testDotAtEnd() {
$this->assertEquals(
'',
IEUrlExtension::findIE6Extension( '.' ),
@@ -116,7 +116,7 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
);
}
- function testTwoDots() {
+ public function testTwoDots() {
$this->assertEquals(
'z',
IEUrlExtension::findIE6Extension( 'x.y.z' ),
diff --git a/tests/phpunit/includes/libs/JavaScriptMinifierTest.php b/tests/phpunit/includes/libs/JavaScriptMinifierTest.php
index 1f550795..ab72e361 100644
--- a/tests/phpunit/includes/libs/JavaScriptMinifierTest.php
+++ b/tests/phpunit/includes/libs/JavaScriptMinifierTest.php
@@ -2,7 +2,7 @@
class JavaScriptMinifierTest extends MediaWikiTestCase {
- function provideCases() {
+ public static function provideCases() {
return array(
// Basic whitespace and comments that should be stripped entirely
@@ -119,7 +119,7 @@ class JavaScriptMinifierTest extends MediaWikiTestCase {
/**
* @dataProvider provideCases
*/
- function testJavaScriptMinifierOutput( $code, $expectedOutput ) {
+ public function testJavaScriptMinifierOutput( $code, $expectedOutput ) {
$minified = JavaScriptMinifier::minify( $code );
// JSMin+'s parser will throw an exception if output is not valid JS.
@@ -132,7 +132,7 @@ class JavaScriptMinifierTest extends MediaWikiTestCase {
$this->assertEquals( $expectedOutput, $minified, "Minified output should be in the form expected." );
}
- function provideBug32548() {
+ public static function provideBug32548() {
return array(
array(
// This one gets interpreted all together by the prior code;
@@ -153,7 +153,7 @@ class JavaScriptMinifierTest extends MediaWikiTestCase {
/**
* @dataProvider provideBug32548
*/
- function testBug32548Exponent( $num ) {
+ public function testBug32548Exponent( $num ) {
// Long line breaking was being incorrectly done between the base and
// exponent part of a number, causing a syntax error. The line should
// instead break at the start of the number.