dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ParserOutput::getCacheTime should stay the same after the first call.
[lhc/web/wiklou.git]
/
tests
/
phpunit
/
includes
/
parser
/
TagHooksTest.php
diff --git
a/tests/phpunit/includes/parser/TagHooksTest.php
b/tests/phpunit/includes/parser/TagHooksTest.php
index
7e31cba
..
06da7a5
100644
(file)
--- a/
tests/phpunit/includes/parser/TagHooksTest.php
+++ b/
tests/phpunit/includes/parser/TagHooksTest.php
@@
-1,10
+1,13
@@
<?php
<?php
+use MediaWiki\MediaWikiServices;
+
/**
* @group Database
* @group Parser
*
* @covers Parser
/**
* @group Database
* @group Parser
*
* @covers Parser
+ * @covers BlockLevelPass
* @covers StripState
*
* @covers Preprocessor_DOM
* @covers StripState
*
* @covers Preprocessor_DOM
@@
-44,9
+47,8
@@
class TagHooksTest extends MediaWikiTestCase {
}
private function getParserOptions() {
}
private function getParserOptions() {
- global $wgContLang;
- $popt = ParserOptions::newFromUserAndLang( new User, $wgContLang );
- $popt->setWrapOutputClass( false );
+ $popt = ParserOptions::newFromUserAndLang( new User,
+ MediaWikiServices::getInstance()->getContentLanguage() );
return $popt;
}
return $popt;
}
@@
-54,8
+56,7
@@
class TagHooksTest extends MediaWikiTestCase {
* @dataProvider provideValidNames
*/
public function testTagHooks( $tag ) {
* @dataProvider provideValidNames
*/
public function testTagHooks( $tag ) {
- global $wgParserConf;
- $parser = new Parser( $wgParserConf );
+ $parser = MediaWikiServices::getInstance()->getParserFactory()->create();
$parser->setHook( $tag, [ $this, 'tagCallback' ] );
$parserOutput = $parser->parse(
$parser->setHook( $tag, [ $this, 'tagCallback' ] );
$parserOutput = $parser->parse(
@@
-63,7
+64,7
@@
class TagHooksTest extends MediaWikiTestCase {
Title::newFromText( 'Test' ),
$this->getParserOptions()
);
Title::newFromText( 'Test' ),
$this->getParserOptions()
);
- $this->assertEquals( "<p>FooOneBaz\n</p>", $parserOutput->getText() );
+ $this->assertEquals( "<p>FooOneBaz\n</p>", $parserOutput->getText(
[ 'unwrap' => true ]
) );
$parser->mPreprocessor = null; # Break the Parser <-> Preprocessor cycle
}
$parser->mPreprocessor = null; # Break the Parser <-> Preprocessor cycle
}
@@
-73,8
+74,7
@@
class TagHooksTest extends MediaWikiTestCase {
* @expectedException MWException
*/
public function testBadTagHooks( $tag ) {
* @expectedException MWException
*/
public function testBadTagHooks( $tag ) {
- global $wgParserConf;
- $parser = new Parser( $wgParserConf );
+ $parser = MediaWikiServices::getInstance()->getParserFactory()->create();
$parser->setHook( $tag, [ $this, 'tagCallback' ] );
$parser->parse(
$parser->setHook( $tag, [ $this, 'tagCallback' ] );
$parser->parse(
@@
-89,8
+89,7
@@
class TagHooksTest extends MediaWikiTestCase {
* @dataProvider provideValidNames
*/
public function testFunctionTagHooks( $tag ) {
* @dataProvider provideValidNames
*/
public function testFunctionTagHooks( $tag ) {
- global $wgParserConf;
- $parser = new Parser( $wgParserConf );
+ $parser = MediaWikiServices::getInstance()->getParserFactory()->create();
$parser->setFunctionTagHook( $tag, [ $this, 'functionTagCallback' ], 0 );
$parserOutput = $parser->parse(
$parser->setFunctionTagHook( $tag, [ $this, 'functionTagCallback' ], 0 );
$parserOutput = $parser->parse(
@@
-98,7
+97,7
@@
class TagHooksTest extends MediaWikiTestCase {
Title::newFromText( 'Test' ),
$this->getParserOptions()
);
Title::newFromText( 'Test' ),
$this->getParserOptions()
);
- $this->assertEquals( "<p>FooOneBaz\n</p>", $parserOutput->getText() );
+ $this->assertEquals( "<p>FooOneBaz\n</p>", $parserOutput->getText(
[ 'unwrap' => true ]
) );
$parser->mPreprocessor = null; # Break the Parser <-> Preprocessor cycle
}
$parser->mPreprocessor = null; # Break the Parser <-> Preprocessor cycle
}
@@
-108,8
+107,7
@@
class TagHooksTest extends MediaWikiTestCase {
* @expectedException MWException
*/
public function testBadFunctionTagHooks( $tag ) {
* @expectedException MWException
*/
public function testBadFunctionTagHooks( $tag ) {
- global $wgParserConf;
- $parser = new Parser( $wgParserConf );
+ $parser = MediaWikiServices::getInstance()->getParserFactory()->create();
$parser->setFunctionTagHook(
$tag,
$parser->setFunctionTagHook(
$tag,