From 0bf458ec624cc0a24dedf7f462b81444a1c726aa Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Mon, 18 Apr 2011 23:20:21 +0000 Subject: [PATCH] Apply phase3 related Title fixes. With one minor addition, Title constructor marked as protected, "just in case"... Patches by Yuvi Panda From (bug 28583) Remove all /* private */ declarations in MediaWiki core --- includes/Title.php | 3 +-- tests/phpunit/includes/SampleTest.php | 2 +- tests/phpunit/includes/parser/TagHooks.php | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index 78af3b080d..11c2d5bc5f 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -78,9 +78,8 @@ class Title { /** * Constructor - * @private */ - /* private */ function __construct() { } + protected function __construct() { } /** * Create a new Title from a prefixed DB key diff --git a/tests/phpunit/includes/SampleTest.php b/tests/phpunit/includes/SampleTest.php index 3c3553f1dc..fa7c4d5b91 100644 --- a/tests/phpunit/includes/SampleTest.php +++ b/tests/phpunit/includes/SampleTest.php @@ -88,7 +88,7 @@ class TestSample extends MediaWikiTestCase { * See http://www.phpunit.de/manual/3.4/en/appendixes.annotations.html#appendixes.annotations.expectedException */ function testTitleObjectFromObject() { - $title = Title::newFromText( new Title( "test" ) ); + $title = Title::newFromText( Title::newFromText( "test" ) ); $this->assertEquals( "Test", $title->isLocal() ); } } diff --git a/tests/phpunit/includes/parser/TagHooks.php b/tests/phpunit/includes/parser/TagHooks.php index f6050728f8..713ce846de 100644 --- a/tests/phpunit/includes/parser/TagHooks.php +++ b/tests/phpunit/includes/parser/TagHooks.php @@ -21,7 +21,7 @@ class TagHookTest extends MediaWikiTestCase { $parser = new Parser( $wgParserConf ); $parser->setHook( $tag, array( $this, 'tagCallback' ) ); - $parserOutput = $parser->parse( "Foo<$tag>BarBaz", new Title( 'Test' ), new ParserOptions ); + $parserOutput = $parser->parse( "Foo<$tag>BarBaz", Title::newFromText( 'Test' ), new ParserOptions ); $this->assertEquals( "

FooOneBaz\n

", $parserOutput->getText() ); $parser->mPreprocessor = null; # Break the Parser <-> Preprocessor cycle @@ -36,7 +36,7 @@ class TagHookTest extends MediaWikiTestCase { $parser = new Parser( $wgParserConf ); $parser->setHook( $tag, array( $this, 'tagCallback' ) ); - $parser->parse( "Foo<$tag>BarBaz", new Title( 'Test' ), new ParserOptions ); + $parser->parse( "Foo<$tag>BarBaz", Title::newFromText( 'Test' ), new ParserOptions ); $this->fail('Exception not thrown.'); } @@ -48,7 +48,7 @@ class TagHookTest extends MediaWikiTestCase { $parser = new Parser( $wgParserConf ); $parser->setFunctionTagHook( $tag, array( $this, 'functionTagCallback' ), 0 ); - $parserOutput = $parser->parse( "Foo<$tag>BarBaz", new Title( 'Test' ), new ParserOptions ); + $parserOutput = $parser->parse( "Foo<$tag>BarBaz", Title::newFromText( 'Test' ), new ParserOptions ); $this->assertEquals( "

FooOneBaz\n

", $parserOutput->getText() ); $parser->mPreprocessor = null; # Break the Parser <-> Preprocessor cycle @@ -63,7 +63,7 @@ class TagHookTest extends MediaWikiTestCase { $parser = new Parser( $wgParserConf ); $parser->setFunctionTagHook( $tag, array( $this, 'functionTagCallback' ), SFH_OBJECT_ARGS ); - $parser->parse( "Foo<$tag>BarBaz", new Title( 'Test' ), new ParserOptions ); + $parser->parse( "Foo<$tag>BarBaz", Title::newFromText( 'Test' ), new ParserOptions ); $this->fail('Exception not thrown.'); } -- 2.20.1