summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/ExtraParserTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/includes/ExtraParserTest.php')
-rw-r--r--tests/phpunit/includes/ExtraParserTest.php27
1 files changed, 13 insertions, 14 deletions
diff --git a/tests/phpunit/includes/ExtraParserTest.php b/tests/phpunit/includes/ExtraParserTest.php
index 067cfc4a..6c67beb1 100644
--- a/tests/phpunit/includes/ExtraParserTest.php
+++ b/tests/phpunit/includes/ExtraParserTest.php
@@ -27,7 +27,7 @@ class ExtraParserTest extends MediaWikiTestCase {
}
// Bug 8689 - Long numeric lines kill the parser
- function testBug8689() {
+ public function testBug8689() {
global $wgUser;
$longLine = '1.' . str_repeat( '1234567890', 100000 ) . "\n";
@@ -38,13 +38,13 @@ class ExtraParserTest extends MediaWikiTestCase {
}
/* Test the parser entry points */
- function testParse() {
+ public function testParse() {
$title = Title::newFromText( __FUNCTION__ );
$parserOutput = $this->parser->parse( "Test\n{{Foo}}\n{{Bar}}", $title, $this->options );
$this->assertEquals( "<p>Test\nContent of <i>Template:Foo</i>\nContent of <i>Template:Bar</i>\n</p>", $parserOutput->getText() );
}
- function testPreSaveTransform() {
+ public function testPreSaveTransform() {
global $wgUser;
$title = Title::newFromText( __FUNCTION__ );
$outputText = $this->parser->preSaveTransform( "Test\r\n{{subst:Foo}}\n{{Bar}}", $title, $wgUser, $this->options );
@@ -52,7 +52,7 @@ class ExtraParserTest extends MediaWikiTestCase {
$this->assertEquals( "Test\nContent of ''Template:Foo''\n{{Bar}}", $outputText );
}
- function testPreprocess() {
+ public function testPreprocess() {
$title = Title::newFromText( __FUNCTION__ );
$outputText = $this->parser->preprocess( "Test\n{{Foo}}\n{{Bar}}", $title, $this->options );
@@ -62,7 +62,7 @@ class ExtraParserTest extends MediaWikiTestCase {
/**
* cleanSig() makes all templates substs and removes tildes
*/
- function testCleanSig() {
+ public function testCleanSig() {
$title = Title::newFromText( __FUNCTION__ );
$outputText = $this->parser->cleanSig( "{{Foo}} ~~~~" );
@@ -72,9 +72,8 @@ class ExtraParserTest extends MediaWikiTestCase {
/**
* cleanSig() should do nothing if disabled
*/
- function testCleanSigDisabled() {
- global $wgCleanSignatures;
- $wgCleanSignatures = false;
+ public function testCleanSigDisabled() {
+ $this->setMwGlobals( 'wgCleanSignatures', false );
$title = Title::newFromText( __FUNCTION__ );
$outputText = $this->parser->cleanSig( "{{Foo}} ~~~~" );
@@ -86,7 +85,7 @@ class ExtraParserTest extends MediaWikiTestCase {
* cleanSigInSig() just removes tildes
* @dataProvider provideStringsForCleanSigInSig
*/
- function testCleanSigInSig( $in, $out ) {
+ public function testCleanSigInSig( $in, $out ) {
$this->assertEquals( Parser::cleanSigInSig( $in ), $out );
}
@@ -98,7 +97,7 @@ class ExtraParserTest extends MediaWikiTestCase {
);
}
- function testGetSection() {
+ public function testGetSection() {
$outputText2 = $this->parser->getSection( "Section 0\n== Heading 1 ==\nSection 1\n=== Heading 2 ===\nSection 2\n== Heading 3 ==\nSection 3\n", 2 );
$outputText1 = $this->parser->getSection( "Section 0\n== Heading 1 ==\nSection 1\n=== Heading 2 ===\nSection 2\n== Heading 3 ==\nSection 3\n", 1 );
@@ -106,7 +105,7 @@ class ExtraParserTest extends MediaWikiTestCase {
$this->assertEquals( "== Heading 1 ==\nSection 1\n=== Heading 2 ===\nSection 2", $outputText1 );
}
- function testReplaceSection() {
+ public function testReplaceSection() {
$outputText = $this->parser->replaceSection( "Section 0\n== Heading 1 ==\nSection 1\n=== Heading 2 ===\nSection 2\n== Heading 3 ==\nSection 3\n", 1, "New section 1" );
$this->assertEquals( "Section 0\nNew section 1\n\n== Heading 3 ==\nSection 3", $outputText );
@@ -115,7 +114,7 @@ class ExtraParserTest extends MediaWikiTestCase {
/**
* Templates and comments are not affected, but noinclude/onlyinclude is.
*/
- function testGetPreloadText() {
+ public function testGetPreloadText() {
$title = Title::newFromText( __FUNCTION__ );
$outputText = $this->parser->getPreloadText( "{{Foo}}<noinclude> censored</noinclude> information <!-- is very secret -->", $title, $this->options );
@@ -135,7 +134,7 @@ class ExtraParserTest extends MediaWikiTestCase {
/**
* @group Database
*/
- function testTrackingCategory() {
+ public function testTrackingCategory() {
$title = Title::newFromText( __FUNCTION__ );
$catName = wfMessage( 'broken-file-category' )->inContentLanguage()->text();
$cat = Title::makeTitleSafe( NS_CATEGORY, $catName );
@@ -148,7 +147,7 @@ class ExtraParserTest extends MediaWikiTestCase {
/**
* @group Database
*/
- function testTrackingCategorySpecial() {
+ public function testTrackingCategorySpecial() {
// Special pages shouldn't have tracking cats.
$title = SpecialPage::getTitleFor( 'Contributions' );
$parserOutput = $this->parser->parse( "[[file:nonexistent]]", $title, $this->options );