);
$otherTestCases[] = array(
$this->getMockDiff( array( $this->getMockDiffOp( 'change', array( 'd1' ), array( 'a1' ) ) ) ),
- array( array( 'action' => 'change', 'old' => 'd1', 'new' => 'mockLine', 'newline' => 1, 'oldline' => 1 ) ),
+ array( array(
+ 'action' => 'change',
+ 'old' => 'd1',
+ 'new' => 'mockLine',
+ 'newline' => 1, 'oldline' => 1
+ ) ),
);
$otherTestCases[] = array(
- $this->getMockDiff( array( $this->getMockDiffOp( 'change', array( 'd1', 'd2' ), array( 'a1', 'a2' ) ) ) ),
+ $this->getMockDiff( array( $this->getMockDiffOp(
+ 'change',
+ array( 'd1', 'd2' ),
+ array( 'a1', 'a2' )
+ ) ) ),
array(
- array( 'action' => 'change', 'old' => 'd1', 'new' => 'mockLine', 'newline' => 1, 'oldline' => 1 ),
- array( 'action' => 'change', 'old' => 'd2', 'new' => 'mockLine', 'newline' => 2, 'oldline' => 2 ),
+ array(
+ 'action' => 'change',
+ 'old' => 'd1',
+ 'new' => 'mockLine',
+ 'newline' => 1, 'oldline' => 1
+ ),
+ array(
+ 'action' => 'change',
+ 'old' => 'd2',
+ 'new' => 'mockLine',
+ 'newline' => 2, 'oldline' => 2
+ ),
),
);
array( 'mwstore://backend/container/path', 'mwstore://backend/container/path' ),
array( 'mwstore://backend/container//path', 'mwstore://backend/container/path' ),
array( 'mwstore://backend/container///path', 'mwstore://backend/container/path' ),
- array( 'mwstore://backend/container///path//to///obj', 'mwstore://backend/container/path/to/obj' ),
+ array(
+ 'mwstore://backend/container///path//to///obj',
+ 'mwstore://backend/container/path/to/obj'
+ ),
array( 'mwstore://', null ),
array( 'mwstore://backend', null ),
array( 'mwstore://backend//container/path', null ),
$contents = $this->backend->getFileContentsMulti( array( 'srcs' => $source ) );
foreach ( $contents as $path => $data ) {
$this->assertNotEquals( false, $data, "Contents of $path exists ($backendName)." );
- $this->assertEquals( current( $content ), $data, "Contents of $path is correct ($backendName)." );
+ $this->assertEquals(
+ current( $content ),
+ $data,
+ "Contents of $path is correct ($backendName)."
+ );
next( $content );
}
- $this->assertEquals( $source, array_keys( $contents ), "Contents in right order ($backendName)." );
- $this->assertEquals( count( $source ), count( $contents ), "Contents array size correct ($backendName)." );
+ $this->assertEquals(
+ $source,
+ array_keys( $contents ),
+ "Contents in right order ($backendName)."
+ );
+ $this->assertEquals(
+ count( $source ),
+ count( $contents ),
+ "Contents array size correct ($backendName)."
+ );
} else {
$data = $this->backend->getFileContents( array( 'src' => $source ) );
$this->assertNotEquals( false, $data, "Contents of $source exists ($backendName)." );
"Creation of local copy of $path succeeded ($backendName)." );
$contents = file_get_contents( $tmpFile->getPath() );
$this->assertNotEquals( false, $contents, "Local copy of $path exists ($backendName)." );
- $this->assertEquals( current( $content ), $contents, "Local copy of $path is correct ($backendName)." );
+ $this->assertEquals(
+ current( $content ),
+ $contents,
+ "Local copy of $path is correct ($backendName)."
+ );
next( $content );
}
- $this->assertEquals( $source, array_keys( $tmpFiles ), "Local copies in right order ($backendName)." );
- $this->assertEquals( count( $source ), count( $tmpFiles ), "Local copies array size correct ($backendName)." );
+ $this->assertEquals(
+ $source,
+ array_keys( $tmpFiles ),
+ "Local copies in right order ($backendName)."
+ );
+ $this->assertEquals(
+ count( $source ),
+ count( $tmpFiles ),
+ "Local copies array size correct ($backendName)."
+ );
} else {
$tmpFile = $this->backend->getLocalCopy( array( 'src' => $source ) );
$this->assertNotNull( $tmpFile,
"Creation of local copy of $source succeeded ($backendName)." );
$contents = file_get_contents( $tmpFile->getPath() );
$this->assertNotEquals( false, $contents, "Local copy of $source exists ($backendName)." );
- $this->assertEquals( $content[0], $contents, "Local copy of $source is correct ($backendName)." );
+ $this->assertEquals(
+ $content[0],
+ $contents,
+ "Local copy of $source is correct ($backendName)."
+ );
}
$obj = new stdClass();
"Creation of local copy of $path succeeded ($backendName)." );
$contents = file_get_contents( $tmpFile->getPath() );
$this->assertNotEquals( false, $contents, "Local ref of $path exists ($backendName)." );
- $this->assertEquals( current( $content ), $contents, "Local ref of $path is correct ($backendName)." );
+ $this->assertEquals(
+ current( $content ),
+ $contents,
+ "Local ref of $path is correct ($backendName)."
+ );
next( $content );
}
- $this->assertEquals( $source, array_keys( $tmpFiles ), "Local refs in right order ($backendName)." );
- $this->assertEquals( count( $source ), count( $tmpFiles ), "Local refs array size correct ($backendName)." );
+ $this->assertEquals(
+ $source,
+ array_keys( $tmpFiles ),
+ "Local refs in right order ($backendName)."
+ );
+ $this->assertEquals(
+ count( $source ),
+ count( $tmpFiles ),
+ "Local refs array size correct ($backendName)."
+ );
} else {
$tmpFile = $this->backend->getLocalReference( array( 'src' => $source ) );
$this->assertNotNull( $tmpFile,
$this->assertEquals( $expected, $list, "Correct file listing ($backendName)." );
// Actual listing (no trailing slash) at root with advise
- $iter = $this->backend->getFileList( array( 'dir' => "$base/unittest-cont1", 'adviseStat' => 1 ) );
+ $iter = $this->backend->getFileList( array(
+ 'dir' => "$base/unittest-cont1",
+ 'adviseStat' => 1
+ ) );
$list = $this->listToArray( $iter );
sort( $list );
$this->assertEquals( $expected, $list, "Correct file listing ($backendName)." );
$this->assertEquals( $expected, $list, "Correct file listing ($backendName)." );
// Actual listing (no trailing slash) at subdir with advise
- $iter = $this->backend->getFileList( array( 'dir' => "$base/unittest-cont1/e/subdir2/subdir", 'adviseStat' => 1 ) );
+ $iter = $this->backend->getFileList( array(
+ 'dir' => "$base/unittest-cont1/e/subdir2/subdir",
+ 'adviseStat' => 1
+ ) );
$list = $this->listToArray( $iter );
sort( $list );
$this->assertEquals( $expected, $list, "Correct file listing ($backendName)." );
sort( $expected );
// Actual listing (top files only) at subdir
- $iter = $this->backend->getTopFileList( array( 'dir' => "$base/unittest-cont1/e/subdir2/subdir" ) );
+ $iter = $this->backend->getTopFileList(
+ array( 'dir' => "$base/unittest-cont1/e/subdir2/subdir" )
+ );
$list = $this->listToArray( $iter );
sort( $list );
$this->assertEquals( $expected, $list, "Correct top file listing ($backendName)." );
// Actual listing (top files only) at subdir with advise
- $iter = $this->backend->getTopFileList( array( 'dir' => "$base/unittest-cont1/e/subdir2/subdir", 'adviseStat' => 1 ) );
+ $iter = $this->backend->getTopFileList( array(
+ 'dir' => "$base/unittest-cont1/e/subdir2/subdir",
+ 'adviseStat' => 1
+ ) );
$list = $this->listToArray( $iter );
sort( $list );
$this->assertEquals( $expected, $list, "Correct top file listing ($backendName)." );
// Actual listing (with trailing slash)
$list = array();
- $iter = $this->backend->getTopDirectoryList( array( 'dir' => "$base/unittest-cont1/e/subdir2/" ) );
+ $iter = $this->backend->getTopDirectoryList(
+ array( 'dir' => "$base/unittest-cont1/e/subdir2/" )
+ );
+
foreach ( $iter as $file ) {
$list[] = $file;
}
}
sort( $list );
- $this->assertEquals( $expected, $list, "Correct top dir listing ($backendName), second iteration." );
+ $this->assertEquals(
+ $expected,
+ $list,
+ "Correct top dir listing ($backendName), second iteration."
+ );
// Expected listing (recursive)
$expected = array(
*/
public function teststore() {
global $IP;
- $this->storecohort( "Test1.png", "$IP/skins/monobook/wiki.png", "$IP/skins/monobook/video.png", false );
- $this->storecohort( "Test2.png", "$IP/skins/monobook/wiki.png", "$IP/skins/monobook/video.png", true );
+ $this->storecohort(
+ "Test1.png",
+ "$IP/skins/monobook/wiki.png",
+ "$IP/skins/monobook/video.png",
+ false
+ );
+ $this->storecohort(
+ "Test2.png",
+ "$IP/skins/monobook/wiki.png",
+ "$IP/skins/monobook/video.png",
+ true
+ );
}
}
public function testValidateCallsUserDefinedValidationCallback() {
$called = false;
$field = new HTMLCheckMatrix( self::$defaultOptions + array(
- 'validation-callback' => function() use ( &$called ) {
+ 'validation-callback' => function () use ( &$called ) {
$called = true;
+
return false;
},
) );
# Transform '$wgFooBar' links
array(
- '<span class="config-plainlink">[https://www.mediawiki.org/wiki/Manual:$wgFooBar $wgFooBar]</span>',
+ '<span class="config-plainlink">'
+ . '[https://www.mediawiki.org/wiki/Manual:$wgFooBar $wgFooBar]</span>',
'$wgFooBar', 'Testing basic $wgFooBar' ),
array(
- '<span class="config-plainlink">[https://www.mediawiki.org/wiki/Manual:$wgFooBar45 $wgFooBar45]</span>',
+ '<span class="config-plainlink">'
+ . '[https://www.mediawiki.org/wiki/Manual:$wgFooBar45 $wgFooBar45]</span>',
'$wgFooBar45', 'Testing $wgFooBar45 (with numbers)' ),
array(
- '<span class="config-plainlink">[https://www.mediawiki.org/wiki/Manual:$wgFoo_Bar $wgFoo_Bar]</span>',
+ '<span class="config-plainlink">'
+ . '[https://www.mediawiki.org/wiki/Manual:$wgFoo_Bar $wgFoo_Bar]</span>',
'$wgFoo_Bar', 'Testing $wgFoo_Bar (with underscore)' ),
# Icky variables that shouldn't link
- array( '$myAwesomeVariable', '$myAwesomeVariable', 'Testing $myAwesomeVariable (not starting with $wg)' ),
+ array(
+ '$myAwesomeVariable',
+ '$myAwesomeVariable',
+ 'Testing $myAwesomeVariable (not starting with $wg)'
+ ),
array( '$()not!a&Var', '$()not!a&Var', 'Testing $()not!a&Var (obviously not a variable)' ),
);
}
array( true, 'host:1521/service:shared', 'Host, port, service and shared server type' ),
array( true, 'host:1521/service:dedicated', 'Host, port, service and dedicated server type' ),
array( true, 'host:1521/service:pooled', 'Host, port, service and pooled server type' ),
- array( true, 'host:1521/service:shared/instance1', 'Host, port, service, server type and instance' ),
+ array(
+ true,
+ 'host:1521/service:shared/instance1',
+ 'Host, port, service, server type and instance'
+ ),
array( true, 'host:1521//instance1', 'Host, port and instance' ),
);
}
}
$title->getBacklinkCache()->clear();
- $this->assertEquals( 20, $title->getBacklinkCache()->getNumLinks( 'pagelinks' ), 'Correct number of backlinks' );
+ $this->assertEquals(
+ 20,
+ $title->getBacklinkCache()->getNumLinks( 'pagelinks' ),
+ 'Correct number of backlinks'
+ );
$job = new RefreshLinksJob( $title, array( 'recursive' => true, 'table' => 'pagelinks' )
+ Job::newRootJobParams( "refreshlinks:pagelinks:{$title->getPrefixedText()}" ) );
$this->assertEquals( $extraParams['rootJobSignature'], $jobs[9]->params['rootJobSignature'],
'Recursive sub-job has root params' );
- $jobs2 = BacklinkJobUtils::partitionBacklinkJob( $jobs[9], 9, 1, array( 'params' => $extraParams ) );
+ $jobs2 = BacklinkJobUtils::partitionBacklinkJob(
+ $jobs[9],
+ 9,
+ 1,
+ array( 'params' => $extraParams )
+ );
$this->assertEquals( 10, count( $jobs2 ), 'Correct number of sub-jobs' );
$this->assertEquals( $pages[9], current( $jobs2[0]->params['pages'] ),
$this->assertEquals( $extraParams['rootJobSignature'], $jobs2[9]->params['rootJobSignature'],
'Recursive sub-job has root params' );
- $jobs3 = BacklinkJobUtils::partitionBacklinkJob( $jobs2[9], 9, 1, array( 'params' => $extraParams ) );
+ $jobs3 = BacklinkJobUtils::partitionBacklinkJob(
+ $jobs2[9],
+ 9,
+ 1,
+ array( 'params' => $extraParams )
+ );
$this->assertEquals( 2, count( $jobs3 ), 'Correct number of sub-jobs' );
$this->assertEquals( $pages[18], current( $jobs3[0]->params['pages'] ),
public function testMinify( $code, $expectedOutput ) {
$minified = CSSMin::minify( $code );
- $this->assertEquals( $expectedOutput, $minified, 'Minified output should be in the form expected.' );
+ $this->assertEquals(
+ $expectedOutput,
+ $minified,
+ 'Minified output should be in the form expected.'
+ );
}
public static function provideMinifyCases() {
}
/**
- * This tests funky parameters to CSSMin::remap. testRemapRemapping tests the basic functionality.
+ * This tests funky parameters to CSSMin::remap. testRemapRemapping tests
+ * the basic functionality.
*
* @dataProvider provideRemapCases
* @covers CSSMin::remap
$remapped = call_user_func_array( 'CSSMin::remap', $params );
$messageAdd = " Case: $message";
- $this->assertEquals( $expectedOutput, $remapped, 'CSSMin::remap should return the expected url form.' . $messageAdd );
+ $this->assertEquals(
+ $expectedOutput,
+ $remapped,
+ 'CSSMin::remap should return the expected url form.' . $messageAdd
+ );
}
public static function provideRemapCases() {
array(
'Embedded file (inline @embed)',
'foo { background: /* @embed */ url(red.gif); }',
- "foo { background: url($red); background: url(http://localhost/w/red.gif?timestamp)!ie; }",
+ "foo { background: url($red); "
+ . "background: url(http://localhost/w/red.gif?timestamp)!ie; }",
),
array(
'Can not embed large files',
array(
'Two regular files in one rule',
'foo { background: url(red.gif), url(green.gif); }',
- 'foo { background: url(http://localhost/w/red.gif?timestamp), url(http://localhost/w/green.gif?timestamp); }',
+ 'foo { background: url(http://localhost/w/red.gif?timestamp), '
+ . 'url(http://localhost/w/green.gif?timestamp); }',
),
array(
'Two embedded files in one rule',
'foo { /* @embed */ background: url(red.gif), url(green.gif); }',
- "foo { background: url($red), url($green); background: url(http://localhost/w/red.gif?timestamp), url(http://localhost/w/green.gif?timestamp)!ie; }",
+ "foo { background: url($red), url($green); "
+ . "background: url(http://localhost/w/red.gif?timestamp), "
+ . "url(http://localhost/w/green.gif?timestamp)!ie; }",
),
array(
'Two embedded files in one rule (inline @embed)',
'foo { background: /* @embed */ url(red.gif), /* @embed */ url(green.gif); }',
- "foo { background: url($red), url($green); background: url(http://localhost/w/red.gif?timestamp), url(http://localhost/w/green.gif?timestamp)!ie; }",
+ "foo { background: url($red), url($green); "
+ . "background: url(http://localhost/w/red.gif?timestamp), "
+ . "url(http://localhost/w/green.gif?timestamp)!ie; }",
),
array(
'Two embedded files in one rule (inline @embed), one too large',
'foo { background: /* @embed */ url(red.gif), /* @embed */ url(large.png); }',
- "foo { background: url($red), url(http://localhost/w/large.png?timestamp); background: url(http://localhost/w/red.gif?timestamp), url(http://localhost/w/large.png?timestamp)!ie; }",
+ "foo { background: url($red), url(http://localhost/w/large.png?timestamp); "
+ . "background: url(http://localhost/w/red.gif?timestamp), "
+ . "url(http://localhost/w/large.png?timestamp)!ie; }",
),
array(
'Practical example with some noise',
'foo { /* @embed */ background: #f9f9f9 url(red.gif) 0 0 no-repeat; }',
- "foo { background: #f9f9f9 url($red) 0 0 no-repeat; background: #f9f9f9 url(http://localhost/w/red.gif?timestamp) 0 0 no-repeat!ie; }",
+ "foo { background: #f9f9f9 url($red) 0 0 no-repeat; "
+ . "background: #f9f9f9 url(http://localhost/w/red.gif?timestamp) 0 0 no-repeat!ie; }",
),
array(
'Does not mess with other properties',
// - Using a tab in a string value (turns into a space)
array( "foo { content: '\t'; }", "foo{content:'\t'}" ),
// - Using css-like syntax in string values
- array( 'foo::after { content: "{;}"; position: absolute; }', 'foo::after{content:"{;}";position:absolute}' ),
+ array(
+ 'foo::after { content: "{;}"; position: absolute; }',
+ 'foo::after{content:"{;}";position:absolute}'
+ ),
);
}
}
abstract class GenericArrayObjectTest extends MediaWikiTestCase {
/**
- * Returns objects that can serve as elements in the concrete GenericArrayObject deriving class being tested.
+ * Returns objects that can serve as elements in the concrete
+ * GenericArrayObject deriving class being tested.
*
* @since 1.20
*
* 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 \
* baz \' quox ' .
*/
- array( "' Foo \\' bar \\\n baz \\' quox ' .length", "' Foo \\' bar \\\n baz \\' quox '.length" ),
- array( "\" Foo \\\" bar \\\n baz \\\" quox \" .length", "\" Foo \\\" bar \\\n baz \\\" quox \".length" ),
+ array(
+ "' Foo \\' bar \\\n baz \\' quox ' .length",
+ "' Foo \\' bar \\\n baz \\' quox '.length"
+ ),
+ array(
+ "\" Foo \\\" bar \\\n baz \\\" quox \" .length",
+ "\" Foo \\\" bar \\\n baz \\\" quox \".length"
+ ),
array( "// Foo b/ar baz", "" ),
- array( "/ Foo \\/ bar [ / \\] / ] baz / .length", "/ Foo \\/ bar [ / \\] / ] baz /.length" ),
+ array(
+ "/ Foo \\/ bar [ / \\] / ] baz / .length",
+ "/ Foo \\/ bar [ / \\] / ] baz /.length"
+ ),
// HTML comments
array( "<!-- Foo bar", "" ),
// Semicolon insertion between an expression having an inline
// comment after it, and a statement on the next line (bug 27046).
- array( "var a = this //foo bar \n for ( b = 0; c < d; b++ ) {}", "var a=this\nfor(b=0;c<d;b++){}" ),
+ array(
+ "var a = this //foo bar \n for ( b = 0; c < d; b++ ) {}",
+ "var a=this\nfor(b=0;c<d;b++){}"
+ ),
// Token separation
array( "x in y", "x in y" ),
array( "var foo=\"\\\nblah\\\n\";", "var foo=\"\\\nblah\\\n\";" ),
// Multiline quoted string followed by string with spaces
- array( "var foo=\"\\\nblah\\\n\";\nvar baz = \" foo \";\n", "var foo=\"\\\nblah\\\n\";var baz=\" foo \";" ),
+ array(
+ "var foo=\"\\\nblah\\\n\";\nvar baz = \" foo \";\n",
+ "var foo=\"\\\nblah\\\n\";var baz=\" foo \";"
+ ),
// URL in quoted string ( // is not a comment)
- array( "aNode.setAttribute('href','http://foo.bar.org/baz');", "aNode.setAttribute('href','http://foo.bar.org/baz');" ),
+ array(
+ "aNode.setAttribute('href','http://foo.bar.org/baz');",
+ "aNode.setAttribute('href','http://foo.bar.org/baz');"
+ ),
// URL in quoted string after multiline quoted string
- array( "var foo=\"\\\nblah\\\n\";\naNode.setAttribute('href','http://foo.bar.org/baz');", "var foo=\"\\\nblah\\\n\";aNode.setAttribute('href','http://foo.bar.org/baz');" ),
+ array(
+ "var foo=\"\\\nblah\\\n\";\naNode.setAttribute('href','http://foo.bar.org/baz');",
+ "var foo=\"\\\nblah\\\n\";aNode.setAttribute('href','http://foo.bar.org/baz');"
+ ),
// Division vs. regex nastiness
- array( "alert( (10+10) / '/'.charCodeAt( 0 ) + '//' );", "alert((10+10)/'/'.charCodeAt(0)+'//');" ),
+ 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
wfRestoreWarnings();
$parser->parse( $minified, 'minify-test.js', 1 );
- $this->assertEquals( $expectedOutput, $minified, "Minified output should be in the form expected." );
+ $this->assertEquals(
+ $expectedOutput,
+ $minified,
+ "Minified output should be in the form expected."
+ );
}
public static function provideBug32548() {