summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/libs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/includes/libs')
-rw-r--r--tests/phpunit/includes/libs/CSSJanusTest.php102
-rw-r--r--tests/phpunit/includes/libs/CSSMinTest.php35
-rw-r--r--tests/phpunit/includes/libs/GenericArrayObjectTest.php46
-rw-r--r--tests/phpunit/includes/libs/IEUrlExtensionTest.php38
-rw-r--r--tests/phpunit/includes/libs/JavaScriptMinifierTest.php22
5 files changed, 153 insertions, 90 deletions
diff --git a/tests/phpunit/includes/libs/CSSJanusTest.php b/tests/phpunit/includes/libs/CSSJanusTest.php
index 54f66077..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 );
@@ -17,10 +19,9 @@ class CSSJanusTest extends MediaWikiTestCase {
$transformedB = CSSJanus::transform( $cssB );
$this->assertEquals( $transformedB, $cssA, 'Test B-A transformation' );
-
- // If no B version is provided, it means
- // the output should equal the input.
} else {
+ // If no B version is provided, it means
+ // the output should equal the input.
$transformedA = CSSJanus::transform( $cssA );
$this->assertEquals( $transformedA, $cssA, 'Nothing was flipped' );
}
@@ -29,22 +30,23 @@ 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;
$flipped = CSSJanus::transform( $code, $swapLtrRtlInURL, $swapLeftRightInURL );
$this->assertEquals( $expectedOutput, $flipped,
- 'Test flipping, options: url-ltr-rtl=' . ($swapLtrRtlInURL ? 'true' : 'false')
- . ' url-left-right=' . ($swapLeftRightInURL ? 'true' : 'false')
+ 'Test flipping, options: url-ltr-rtl=' . ( $swapLtrRtlInURL ? 'true' : 'false' )
+ . ' url-left-right=' . ( $swapLeftRightInURL ? 'true' : 'false' )
);
}
+
/**
* @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,10 +139,15 @@ 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; }'
),
@@ -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(
- '.foo { x-unknown: 1 2 3 4 5 6; }',
- '.foo { x-unknown: 1 4 3 2 5 6; }',
+ // 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(
+ // 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; }'
@@ -458,6 +504,16 @@ class CSSJanusTest extends MediaWikiTestCase {
".foo\t{\tleft\t:\t0;}",
".foo\t{\tright\t:\t0;}"
),
+
+ // Guard against partial keys
+ array(
+ '.foo { leftxx: 0; }',
+ '.foo { leftxx: 0; }'
+ ),
+ array(
+ '.foo { rightxx: 0; }',
+ '.foo { rightxx: 0; }'
+ ),
);
}
@@ -466,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',
@@ -532,18 +588,8 @@ 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 partial keys
- array(
- '.foo { leftxx: 0; }',
- '.foo { leftxx: 0; }'
- ),
- array(
- '.foo { rightxx: 0; }',
- '.foo { rightxx: 0; }'
- ),
-
// Guard against selectors that look flippable
array(
# <foo-left-x attr="x">
diff --git a/tests/phpunit/includes/libs/CSSMinTest.php b/tests/phpunit/includes/libs/CSSMinTest.php
index a3827756..951dd7b9 100644
--- a/tests/phpunit/includes/libs/CSSMinTest.php
+++ b/tests/phpunit/includes/libs/CSSMinTest.php
@@ -6,37 +6,28 @@
*/
class CSSMinTest extends MediaWikiTestCase {
- protected $oldServer = null, $oldCanServer = null;
- function setUp() {
+ protected function setUp() {
parent::setUp();
- // Fake $wgServer and $wgCanonicalServer
- global $wgServer, $wgCanonicalServer;
- $this->oldServer = $wgServer;
- $this->oldCanServer = $wgCanonicalServer;
- $wgServer = $wgCanonicalServer = 'http://wiki.example.org';
- }
-
- function tearDown() {
- // Restore $wgServer and $wgCanonicalServer
- global $wgServer, $wgCanonicalServer;
- $wgServer = $this->oldServer;
- $wgCanonicalServer = $this->oldCanServer;
+ $server = 'http://doc.example.org';
- parent::tearDown();
+ $this->setMwGlobals( array(
+ 'wgServer' => $server,
+ 'wgCanonicalServer' => $server,
+ ) );
}
/**
* @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", "" ),
@@ -79,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(
@@ -113,7 +104,7 @@ class CSSMinTest extends MediaWikiTestCase {
array(
'Expand absolute paths',
array( 'foo { prop: url(/w/skin/images/bar.png); }', false, 'http://example.org/quux', false ),
- 'foo { prop: url(http://wiki.example.org/w/skin/images/bar.png); }',
+ 'foo { prop: url(http://doc.example.org/w/skin/images/bar.png); }',
),
);
}
@@ -124,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 70fce111..7436c43c 100644
--- a/tests/phpunit/includes/libs/GenericArrayObjectTest.php
+++ b/tests/phpunit/includes/libs/GenericArrayObjectTest.php
@@ -36,7 +36,7 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
*
* @return array
*/
- public abstract function elementInstancesProvider();
+ abstract public function elementInstancesProvider();
/**
* Returns the name of the concrete class being tested.
@@ -45,7 +45,7 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
*
* @return string
*/
- public abstract function getInstanceClass();
+ abstract public function getInstanceClass();
/**
* Provides instances of the concrete class being tested.
@@ -58,7 +58,7 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
$instances = array();
foreach ( $this->elementInstancesProvider() as $elementInstances ) {
- $instances[] = $this->getNew( $elementInstances );
+ $instances[] = $this->getNew( $elementInstances[0] );
}
return $this->arrayWrap( $instances );
@@ -73,6 +73,7 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
*/
protected function getNew( array $elements = array() ) {
$class = $this->getInstanceClass();
+
return new $class( $elements );
}
@@ -110,7 +111,9 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
* @param GenericArrayObject $list
*/
public function testUnset( GenericArrayObject $list ) {
- if ( !$list->isEmpty() ) {
+ if ( $list->isEmpty() ) {
+ $this->assertTrue( true ); // We cannot test unset if there are no elements
+ } else {
$offset = $list->getIterator()->key();
$count = $list->count();
$list->offsetUnset( $offset );
@@ -123,10 +126,6 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
unset( $list[$offset] );
$this->assertEquals( $count - 1, $list->count() );
}
-
- $exception = null;
- try { $list->offsetUnset( 'sdfsedtgsrdysftu' ); } catch ( \Exception $exception ){}
- $this->assertInstanceOf( '\Exception', $exception );
}
/**
@@ -155,7 +154,7 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
$this->assertEquals( $listSize, $list->count() );
- $this->checkTypeChecks( function( GenericArrayObject $list, $element ) {
+ $this->checkTypeChecks( function ( GenericArrayObject $list, $element ) {
$list->append( $element );
} );
}
@@ -171,14 +170,13 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
$elementClass = $list->getObjectType();
- foreach ( array( 42, 'foo', array(), new \stdClass(), 4.2 ) as $element ) {
+ foreach ( array( 42, 'foo', array(), new stdClass(), 4.2 ) as $element ) {
$validValid = $element instanceof $elementClass;
- try{
+ try {
call_user_func( $function, $list, $element );
$valid = true;
- }
- catch ( InvalidArgumentException $exception ) {
+ } catch ( InvalidArgumentException $exception ) {
$valid = false;
}
@@ -200,6 +198,7 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
public function testOffsetSet( array $elements ) {
if ( $elements === array() ) {
$this->assertTrue( true );
+
return;
}
@@ -237,9 +236,28 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
$this->assertEquals( count( $elements ), $list->count() );
- $this->checkTypeChecks( function( GenericArrayObject $list, $element ) {
+ $this->checkTypeChecks( function ( GenericArrayObject $list, $element ) {
$list->offsetSet( mt_rand(), $element );
} );
}
+ /**
+ * @dataProvider instanceProvider
+ *
+ * @since 1.21
+ *
+ * @param GenericArrayObject $list
+ */
+ public function testSerialization( GenericArrayObject $list ) {
+ $serialization = serialize( $list );
+ $copy = unserialize( $serialization );
+
+ $this->assertEquals( $serialization, serialize( $copy ) );
+ $this->assertEquals( count( $list ), count( $copy ) );
+
+ $list = $list->getArrayCopy();
+ $copy = $copy->getArrayCopy();
+
+ $this->assertArrayEquals( $list, $copy, true, true );
+ }
}
diff --git a/tests/phpunit/includes/libs/IEUrlExtensionTest.php b/tests/phpunit/includes/libs/IEUrlExtensionTest.php
index c6270e90..66fe915a 100644
--- a/tests/phpunit/includes/libs/IEUrlExtensionTest.php
+++ b/tests/phpunit/includes/libs/IEUrlExtensionTest.php
@@ -4,15 +4,15 @@
* Tests for IEUrlExtension::findIE6Extension
*/
class IEUrlExtensionTest extends MediaWikiTestCase {
- function testSimple() {
- $this->assertEquals(
+ public function testSimple() {
+ $this->assertEquals(
'y',
IEUrlExtension::findIE6Extension( 'x.y' ),
'Simple extension'
);
}
- 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,11 +108,19 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
);
}
- function testDotAtEnd() {
+ public function testDotAtEnd() {
$this->assertEquals(
'',
IEUrlExtension::findIE6Extension( '.' ),
'Dot at end of string'
);
}
+
+ public function testTwoDots() {
+ $this->assertEquals(
+ 'z',
+ IEUrlExtension::findIE6Extension( 'x.y.z' ),
+ 'Two dots'
+ );
+ }
}
diff --git a/tests/phpunit/includes/libs/JavaScriptMinifierTest.php b/tests/phpunit/includes/libs/JavaScriptMinifierTest.php
index f121b018..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
@@ -14,7 +14,7 @@ class JavaScriptMinifierTest extends MediaWikiTestCase {
* At some point there was a bug that caused this comment to be ended at '* /',
* causing /M... to be left as the beginning of a regex.
*/
- array( "/**\n * Foo\n * {\n * 'bar' : {\n * //Multiple rules with configurable operators\n * 'baz' : false\n * }\n */", ""),
+ array( "/**\n * Foo\n * {\n * 'bar' : {\n * //Multiple rules with configurable operators\n * 'baz' : false\n * }\n */", "" ),
/**
* ' Foo \' bar \
@@ -80,7 +80,7 @@ class JavaScriptMinifierTest extends MediaWikiTestCase {
array( "switch(x){case y?z:{}/ x/g:{}/ x/g;}", "switch(x){case y?z:{}/x/g:{}/ x/g;}" ),
array( "function x(){}/ x/g", "function x(){}/ x/g" ),
array( "+function x(){}/ x/g", "+function x(){}/x/g" ),
-
+
// Multiline quoted string
array( "var foo=\"\\\nblah\\\n\";", "var foo=\"\\\nblah\\\n\";" ),
@@ -96,16 +96,16 @@ class JavaScriptMinifierTest extends MediaWikiTestCase {
// Division vs. regex nastiness
array( "alert( (10+10) / '/'.charCodeAt( 0 ) + '//' );", "alert((10+10)/'/'.charCodeAt(0)+'//');" ),
array( "if(1)/a /g.exec('Pa ss');", "if(1)/a /g.exec('Pa ss');" ),
-
+
// newline insertion after 1000 chars: break after the "++", not before
array( str_repeat( ';', 996 ) . "if(x++);", str_repeat( ';', 996 ) . "if(x++\n);" ),
// Unicode letter characters should pass through ok in identifiers (bug 31187)
- array( "var KaŝSkatolVal = {}", 'var KaŝSkatolVal={}'),
+ array( "var KaŝSkatolVal = {}", 'var KaŝSkatolVal={}' ),
// Per spec unicode char escape values should work in identifiers,
// as long as it's a valid char. In future it might get normalized.
- array( "var Ka\\u015dSkatolVal = {}", 'var Ka\\u015dSkatolVal={}'),
+ array( "var Ka\\u015dSkatolVal = {}", 'var Ka\\u015dSkatolVal={}' ),
// Some structures that might look invalid at first sight
array( "var a = 5.;", "var a=5.;" ),
@@ -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,12 +132,12 @@ 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;
// no break at the 'E' happens.
- '1.23456789E55',
+ '1.23456789E55',
),
array(
// This one breaks under the bad code; splits between 'E' and '+'
@@ -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.
@@ -165,6 +165,6 @@ class JavaScriptMinifierTest extends MediaWikiTestCase {
$minified = JavaScriptMinifier::minify( $input );
- $this->assertEquals( $expected, $minified, "Line breaks must not occur in middle of exponent");
+ $this->assertEquals( $expected, $minified, "Line breaks must not occur in middle of exponent" );
}
}