From d9022f63880ce039446fba8364f68e656b7bf4cb Mon Sep 17 00:00:00 2001
From: Pierre Schmitz
Date: Thu, 3 May 2012 13:01:35 +0200
Subject: Update to MediaWiki 1.19.0
---
tests/parser/README | 8 +
tests/parser/parserTest.inc | 124 ++++---
tests/parser/parserTests.txt | 382 ++++++++++++++++++---
tests/parser/parserTestsParserHook.php | 26 +-
tests/parser/parserTestsStaticParserHook.php | 58 ----
.../parser/preprocess/All_system_messages.expected | 2 +-
tests/parser/preprocess/Factorial.expected | 2 +-
7 files changed, 451 insertions(+), 151 deletions(-)
create mode 100644 tests/parser/README
delete mode 100644 tests/parser/parserTestsStaticParserHook.php
(limited to 'tests/parser')
diff --git a/tests/parser/README b/tests/parser/README
new file mode 100644
index 00000000..8b413376
--- /dev/null
+++ b/tests/parser/README
@@ -0,0 +1,8 @@
+Parser tests are run using our PHPUnit test suite in tests/phpunit:
+
+ $ cd tests/phpunit
+ ./phpunit.php --group Parser
+
+You can optionally filter by title using --regex. I.e. :
+
+ ./phpunit.php --group Parser --regex="Bug 6200"
diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc
index 0ce7c997..30e451b3 100644
--- a/tests/parser/parserTest.inc
+++ b/tests/parser/parserTest.inc
@@ -105,6 +105,9 @@ class ParserTest {
$this->showOutput = isset( $options['show-output'] );
+ if ( isset( $options['filter'] ) ) {
+ $options['regex'] = $options['filter'];
+ }
if ( isset( $options['regex'] ) ) {
if ( isset( $options['record'] ) ) {
@@ -132,45 +135,65 @@ class ParserTest {
}
static function setUp() {
- global $wgParser, $wgParserConf, $IP, $messageMemc, $wgMemc, $wgDeferredUpdateList,
+ global $wgParser, $wgParserConf, $IP, $messageMemc, $wgMemc,
$wgUser, $wgLang, $wgOut, $wgRequest, $wgStyleDirectory, $wgEnableParserCache,
$wgNamespaceAliases, $wgNamespaceProtection, $wgLocalFileRepo,
$parserMemc, $wgThumbnailScriptPath, $wgScriptPath,
- $wgArticlePath, $wgStyleSheetPath, $wgScript, $wgStylePath;
+ $wgArticlePath, $wgStyleSheetPath, $wgScript, $wgStylePath, $wgExtensionAssetsPath,
+ $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType;
$wgScript = '/index.php';
$wgScriptPath = '/';
$wgArticlePath = '/wiki/$1';
$wgStyleSheetPath = '/skins';
$wgStylePath = '/skins';
+ $wgExtensionAssetsPath = '/extensions';
$wgThumbnailScriptPath = false;
$wgLocalFileRepo = array(
- 'class' => 'LocalRepo',
- 'name' => 'local',
- 'directory' => wfTempDir() . '/test-repo',
- 'url' => 'http://example.com/images',
- 'deletedDir' => wfTempDir() . '/test-repo/delete',
- 'hashLevels' => 2,
+ 'class' => 'LocalRepo',
+ 'name' => 'local',
+ 'url' => 'http://example.com/images',
+ 'hashLevels' => 2,
'transformVia404' => false,
+ 'backend' => new FSFileBackend( array(
+ 'name' => 'local-backend',
+ 'lockManager' => 'fsLockManager',
+ 'containerPaths' => array(
+ 'local-public' => wfTempDir() . '/test-repo/public',
+ 'local-thumb' => wfTempDir() . '/test-repo/thumb',
+ 'local-temp' => wfTempDir() . '/test-repo/temp',
+ 'local-deleted' => wfTempDir() . '/test-repo/deleted',
+ )
+ ) )
);
$wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface';
$wgNamespaceAliases['Image'] = NS_FILE;
$wgNamespaceAliases['Image_talk'] = NS_FILE_TALK;
+ // XXX: tests won't run without this (for CACHE_DB)
+ if ( $wgMainCacheType === CACHE_DB ) {
+ $wgMainCacheType = CACHE_NONE;
+ }
+ if ( $wgMessageCacheType === CACHE_DB ) {
+ $wgMessageCacheType = CACHE_NONE;
+ }
+ if ( $wgParserCacheType === CACHE_DB ) {
+ $wgParserCacheType = CACHE_NONE;
+ }
$wgEnableParserCache = false;
- $wgDeferredUpdateList = array();
- $wgMemc = wfGetMainCache();
+ DeferredUpdates::clearPendingUpdates();
+ $wgMemc = wfGetMainCache(); // checks $wgMainCacheType
$messageMemc = wfGetMessageCacheStorage();
$parserMemc = wfGetParserCacheStorage();
// $wgContLang = new StubContLang;
$wgUser = new User;
$context = new RequestContext;
- $wgLang = $context->getLang();
+ $wgLang = $context->getLanguage();
$wgOut = $context->getOutput();
$wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
- $wgRequest = new WebRequest;
+ $wgRequest = $context->getRequest();
if ( $wgStyleDirectory === false ) {
$wgStyleDirectory = "$IP/skins";
@@ -423,10 +446,10 @@ class ParserTest {
}
$opts = $this->parseOptions( $opts );
- $this->setupGlobals( $opts, $config );
+ $context = $this->setupGlobals( $opts, $config );
- $user = new User();
- $options = ParserOptions::newFromUser( $user );
+ $user = $context->getUser();
+ $options = ParserOptions::newFromContext( $context );
if ( isset( $opts['title'] ) ) {
$titleText = $opts['title'];
@@ -452,8 +475,7 @@ class ParserTest {
$replace = $opts['replace'][1];
$out = $parser->replaceSection( $input, $section, $replace );
} elseif ( isset( $opts['comment'] ) ) {
- $linker = $user->getSkin();
- $out = $linker->formatComment( $input, $title, $local );
+ $out = Linker::formatComment( $input, $title, $local );
} elseif ( isset( $opts['preload'] ) ) {
$out = $parser->getpreloadText( $input, $title, $options );
} else {
@@ -471,10 +493,9 @@ class ParserTest {
if ( isset( $opts['ill'] ) ) {
$out = $this->tidy( implode( ' ', $output->getLanguageLinks() ) );
} elseif ( isset( $opts['cat'] ) ) {
- global $wgOut;
-
- $wgOut->addCategoryLinks( $output->getCategories() );
- $cats = $wgOut->getCategoryLinks();
+ $outputPage = $context->getOutput();
+ $outputPage->addCategoryLinks( $output->getCategories() );
+ $cats = $outputPage->getCategoryLinks();
if ( isset( $cats['normal'] ) ) {
$out = $this->tidy( implode( ' ', $cats['normal'] ) );
@@ -609,10 +630,19 @@ class ParserTest {
'wgLocalFileRepo' => array(
'class' => 'LocalRepo',
'name' => 'local',
- 'directory' => $this->uploadDir,
'url' => 'http://example.com/images',
'hashLevels' => 2,
'transformVia404' => false,
+ 'backend' => new FSFileBackend( array(
+ 'name' => 'local-backend',
+ 'lockManager' => 'fsLockManager',
+ 'containerPaths' => array(
+ 'local-public' => $this->uploadDir,
+ 'local-thumb' => $this->uploadDir . '/thumb',
+ 'local-temp' => $this->uploadDir . '/temp',
+ 'local-deleted' => $this->uploadDir . '/delete',
+ )
+ ) )
),
'wgEnableUploads' => self::getOptionValue( 'wgEnableUploads', $opts, true ),
'wgStylePath' => '/skins',
@@ -650,6 +680,7 @@ class ParserTest {
'wgExternalLinkTarget' => false,
'wgAlwaysUseTidy' => false,
'wgHtml5' => true,
+ 'wgCleanupPresentationalAttributes' => true,
'wgWellFormedXml' => true,
'wgAllowMicrodataAttributes' => true,
'wgAdaptiveMessageCache' => true,
@@ -681,7 +712,7 @@ class ParserTest {
$GLOBALS['wgMemc'] = new EmptyBagOStuff;
$context = new RequestContext();
- $GLOBALS['wgLang'] = $context->getLang();
+ $GLOBALS['wgLang'] = $context->getLanguage();
$GLOBALS['wgOut'] = $context->getOutput();
$GLOBALS['wgUser'] = new User();
@@ -689,10 +720,11 @@ class ParserTest {
global $wgHooks;
$wgHooks['ParserTestParser'][] = 'ParserTestParserHook::setup';
- $wgHooks['ParserTestParser'][] = 'ParserTestStaticParserHook::setup';
$wgHooks['ParserGetVariableValueTs'][] = 'ParserTest::getFakeTimestamp';
MagicWord::clearCache();
+
+ return $context;
}
/**
@@ -700,7 +732,7 @@ class ParserTest {
* Some of these probably aren't necessary.
*/
private function listTables() {
- $tables = array( 'user', 'user_properties', 'page', 'page_restrictions',
+ $tables = array( 'user', 'user_properties', 'user_former_groups', 'page', 'page_restrictions',
'protected_titles', 'revision', 'text', 'pagelinks', 'imagelinks',
'categorylinks', 'templatelinks', 'externallinks', 'langlinks', 'iwlinks',
'site_stats', 'hitcounter', 'ipblocks', 'image', 'oldimage',
@@ -709,8 +741,9 @@ class ParserTest {
'archive', 'user_groups', 'page_props', 'category', 'msg_resource', 'msg_resource_links'
);
- if ( in_array( $this->db->getType(), array( 'mysql', 'sqlite', 'oracle' ) ) )
+ if ( in_array( $this->db->getType(), array( 'mysql', 'sqlite', 'oracle' ) ) ) {
array_push( $tables, 'searchindex' );
+ }
// Allow extensions to add to the list of tables to duplicate;
// may be necessary if they hook into page save or other code
@@ -753,17 +786,14 @@ class ParserTest {
}
$temporary = $this->useTemporaryTables || $dbType == 'postgres';
- $tables = $this->listTables();
$prefix = $dbType != 'oracle' ? 'parsertest_' : 'pt_';
$this->dbClone = new CloneDatabase( $this->db, $this->listTables(), $prefix );
$this->dbClone->useTemporaryTables( $temporary );
$this->dbClone->cloneTableStructure();
- if ( $dbType == 'oracle' )
- $this->db->query( 'BEGIN FILL_WIKI_INFO; END;' );
-
if ( $dbType == 'oracle' ) {
+ $this->db->query( 'BEGIN FILL_WIKI_INFO; END;' );
# Insert 0 user to prevent FK violations
# Anonymous user
@@ -807,7 +837,6 @@ class ParserTest {
'iw_local' => 1 ),
) );
-
# Update certain things in site_stats
$this->db->insert( 'site_stats', array( 'ss_row_id' => 1, 'ss_images' => 2, 'ss_good_articles' => 1 ) );
@@ -908,9 +937,9 @@ class ParserTest {
return $dir;
}
- wfMkdirParents( $dir . '/3/3a' );
+ wfMkdirParents( $dir . '/3/3a', null, __METHOD__ );
copy( "$IP/skins/monobook/headbg.jpg", "$dir/3/3a/Foobar.jpg" );
- wfMkdirParents( $dir . '/0/09' );
+ wfMkdirParents( $dir . '/0/09', null, __METHOD__ );
copy( "$IP/skins/monobook/headbg.jpg", "$dir/0/09/Bad.jpg" );
return $dir;
@@ -1077,7 +1106,9 @@ class ParserTest {
$shellInfile = wfEscapeShellArg($infile);
$shellOutfile = wfEscapeShellArg($outfile);
- $diff = wfIsWindows()
+ global $wgDiff3;
+ // we assume that people with diff3 also have usual diff
+ $diff = ( wfIsWindows() && !$wgDiff3 )
? `fc $shellInfile $shellOutfile`
: `diff -au $shellInfile $shellOutfile`;
unlink( $infile );
@@ -1130,30 +1161,35 @@ class ParserTest {
* @param $name String: the title, including any prefix
* @param $text String: the article text
* @param $line Integer: the input line number, for reporting errors
+ * @param $ignoreDuplicate Boolean: whether to silently ignore duplicate pages
*/
- static public function addArticle( $name, $text, $line = 'unknown' ) {
+ static public function addArticle( $name, $text, $line = 'unknown', $ignoreDuplicate = '' ) {
global $wgCapitalLinks;
- $text = self::chomp($text);
-
$oldCapitalLinks = $wgCapitalLinks;
$wgCapitalLinks = true; // We only need this from SetupGlobals() See r70917#c8637
+ $text = self::chomp( $text );
$name = self::chomp( $name );
+
$title = Title::newFromText( $name );
if ( is_null( $title ) ) {
- throw new MWException( "invalid title ('$name' => '$title') at line $line\n" );
+ throw new MWException( "invalid title '$name' at line $line\n" );
}
- $aid = $title->getArticleID( Title::GAID_FOR_UPDATE );
+ $page = WikiPage::factory( $title );
+ $page->loadPageData( 'fromdbmaster' );
- if ( $aid != 0 ) {
- throw new MWException( "duplicate article '$name' at line $line\n" );
+ if ( $page->exists() ) {
+ if ( $ignoreDuplicate == 'ignoreduplicate' ) {
+ return;
+ } else {
+ throw new MWException( "duplicate article '$name' at line $line\n" );
+ }
}
- $art = new Article( $title );
- $art->doEdit( $text, '', EDIT_NEW );
+ $page->doEdit( $text, '', EDIT_NEW );
$wgCapitalLinks = $oldCapitalLinks;
}
@@ -1204,7 +1240,7 @@ class ParserTest {
return true;
}
- /*
+ /**
* Run the "tidy" command on text if the $wgUseTidy
* global is true
*
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index 999cd717..d304b19c 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -615,6 +615,26 @@ disabled
!! end
+!! test
+Definition and unordered list using wiki syntax nested in unordered list using html tags.
+!! input
+-
+; term : description
+* unordered
+
+
+!! result
+-
+
- term
- description
+
+
+
+
+
+!! end
+
+
###
### External links
###
@@ -1050,8 +1070,10 @@ http://www.example.com/?title=AT%26T
!! end
+# According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
+# % is actually legal in HTML5. Any change in output would need testing though.
!! test
-Bug 4781, 5267: %26 in URL
+Bug 4781, 5267: %25 in URL
!! input
http://www.example.com/?title=100%25_Bran
!! result
@@ -1169,6 +1191,29 @@ URL-encoding in URL functions (multiple parameters)
!! end
+!! test
+Brackets in urls
+!! input
+http://example.com/index.php?foozoid%5B%5D=bar
+
+http://example.com/index.php?foozoid[]=bar
+!! result
+http://example.com/index.php?foozoid%5B%5D=bar
+
http://example.com/index.php?foozoid%5B%5D=bar
+
+!! end
+
+!! test
+IPv6 urls (bug 21261)
+!! options
+disabled
+!! input
+http://[2404:130:0:1000::187:2]/index.php
+!! result
+http://[2404:130:0:1000::187:2]/index.php
+
+!! end
+
###
### Quotes
###
@@ -1346,7 +1391,7 @@ Multiplication table
!! test
Table rowspan
!! input
-{| align=right border=1
+{| border=1
| Cell 1, row 1
|rowspan=2| Cell 2, row 1 (and 2)
| Cell 3, row 1
@@ -1355,7 +1400,7 @@ Table rowspan
| Cell 3, row 2
|}
!! result
-
+
Cell 1, row 1
|
@@ -1435,6 +1480,28 @@ Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitec
!! end
+!! test
+Indented table markup mixed with indented pre content (proposed in bug 6200)
+!! input
+
+
+
+ Text that should be rendered preformatted
+ |
+
+
+!! result
+
+
+
+Text that should be rendered preformatted
+
+ |
+
+
+
+!! end
+
###
### Internal links
@@ -1872,7 +1939,7 @@ Inline interwiki link with empty title (bug 2372)
!! input
[[MeatBall:]]
!! result
-MeatBall:
+
MeatBall:
!! end
@@ -1969,13 +2036,13 @@ Incorrecly removing closing slashes from correctly formed XHTML
!! test
Failing to transform badly formed HTML into correct XHTML
!! input
-
-
-
+
+
+
!! result
-
-
-
+
+
+
!!end
@@ -3026,35 +3093,6 @@ section=1
==Section 1==
!! result
==Section 1==
-!! end
-!! article
-Template:Top-level template
-!! text
-{{Nested template}}
-!! endarticle
-
-!! article
-Template:Nested template
-!! text
-*Item 1
-*Item 2
-!! endarticle
-
-!! test
-Line-start flag in a nested template call
-!! input
-*Item A
-*Item B
-
-{{Top-level template}}
-!! result
-
-
-
!! end
###
@@ -3420,6 +3458,66 @@ pst title=[[Ns:Somearticle (IGNORED), Context]]
[[Ns:Article, Context|Article]]
!! end
+!! test
+pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
+!! options
+pst
+!! input
+[[Article(context)|]]
+[[Bar:Article(context)|]]
+[[:Bar:Article(context)|]]
+[[|Article(context)]]
+[[Bar:X (Y) Z|]]
+[[:Bar:X (Y) Z|]]
+!! result
+[[Article(context)|Article]]
+[[Bar:Article(context)|Article]]
+[[:Bar:Article(context)|Article]]
+[[Article(context)]]
+[[Bar:X (Y) Z|X (Y) Z]]
+[[:Bar:X (Y) Z|X (Y) Z]]
+!! end
+
+!! test
+pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
+!! options
+pst
+!! input
+[[Article (context)|]]
+[[Bar:Article (context)|]]
+[[:Bar:Article (context)|]]
+[[|Article (context)]]
+[[Bar:X (Y) Z|]]
+[[:Bar:X (Y) Z|]]
+!! result
+[[Article (context)|Article]]
+[[Bar:Article (context)|Article]]
+[[:Bar:Article (context)|Article]]
+[[Article (context)]]
+[[Bar:X (Y) Z|X (Y) Z]]
+[[:Bar:X (Y) Z|X (Y) Z]]
+!! end
+
+!! test
+pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
+!! options
+pst
+!! input
+[[Article(context)|]]
+[[Bar:Article(context)|]]
+[[:Bar:Article(context)|]]
+[[|Article(context)]]
+[[Bar:X(Y)Z|]]
+[[:Bar:X(Y)Z|]]
+!! result
+[[Article(context)|Article]]
+[[Bar:Article(context)|Article]]
+[[:Bar:Article(context)|Article]]
+[[Article(context)]]
+[[Bar:X(Y)Z|X(Y)Z]]
+[[:Bar:X(Y)Z|X(Y)Z]]
+!! end
+
!! test
pre-save transform: trim trailing empty lines
!! options
@@ -4487,9 +4585,9 @@ div with unquoted attribute
!! test
div with illegal double attributes
!! input
-HTML rocks
+HTML rocks
!! result
-HTML rocks
+HTML rocks
!!end
@@ -4519,9 +4617,9 @@ Table multiple attributes correction
!! test
DIV IN UPPERCASE
!! input
-HTML ROCKS
+HTML ROCKS
!! result
-HTML ROCKS
+HTML ROCKS
!!end
@@ -8381,7 +8479,17 @@ comment title=[[Main Page]]
!! input
/* External links */ removed bogus entries
!! result
- removed bogus entries
+→ removed bogus entries
+!!end
+
+!! test
+Edit comment with section link and text before it (non-local, eg in history list)
+!! options
+comment title=[[Main Page]]
+!! input
+pre-comment text /* External links */ removed bogus entries
+!! result
+pre-comment text - → removed bogus entries
!!end
!! test
@@ -8391,7 +8499,7 @@ comment local title=[[Main Page]]
!! input
/* External links */ removed bogus entries
!! result
- removed bogus entries
+→ removed bogus entries
!!end
!! test
@@ -8478,7 +8586,7 @@ title=[[Main Page]]
!!input
/* __hello__world__ */
!! result
-
+→
!! end
!! test
@@ -8493,6 +8601,8 @@ comment
!! test
Bad images - basic functionality
+!! options
+disabled
!! input
[[File:Bad.jpg]]
!! result
@@ -8500,6 +8610,8 @@ Bad images - basic functionality
!! test
Bad images - bug 16039: text after bad image disappears
+!! options
+disabled
!! input
Foo bar
[[File:Bad.jpg]]
@@ -8713,6 +8825,33 @@ Text's been normalized?
!! end
+!! test
+Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
+!! input
+http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
+!! result
+http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
+
+!! end
+
+!! test
+Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
+!! input
+[http://www.example.org/ ideograms]
+!! result
+ideograms
+
+!! end
+
+!! test
+Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
+!! input
+http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
+!! result
+ <-- U+3000 (vim: ^Vu3000)
+
+!! end
+
!! article
Mediawiki:loop1
!! text
@@ -8742,6 +8881,22 @@ Bug 31098 Template which includes system messages which includes the template
!! end
+!! test
+Deprecated presentational attributes are converted to css
+!! input
+{|
+| valign=top align=left width=100 height=25% | Asdf
+|}
+
+!! result
+
+
+
+!! end
+
!! test
Bug31490 Turkish: ucfirst 'blah'
!! options
@@ -8797,6 +8952,132 @@ language=en
!! end
+!! test
+Bug 26375: TOC with italics
+!! options
+title=[[Main Page]]
+!! input
+__TOC__
+== ''Lost'' episodes ==
+!! result
+
+[edit] Lost episodes
+
+!! end
+
+!! test
+Bug 26375: TOC with bold
+!! options
+title=[[Main Page]]
+!! input
+__TOC__
+== '''should be bold''' then normal text ==
+!! result
+
+[edit] should be bold then normal text
+
+!! end
+
+!! test
+Bug 33845: Headings become cursive in TOC when they contain an image
+!! options
+title=[[Main Page]]
+!! input
+__TOC__
+== Image [[Image:foobar.jpg]] ==
+!! result
+
+
+
+!! end
+
+!! test
+Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
+!! options
+title=[[Main Page]]
+!! input
+__TOC__
+== Quote
==
+!! result
+
+
+
+!! end
+
+!! test
+Unclosed tags in TOC
+!! options
+title=[[Main Page]]
+!! input
+__TOC__
+== Proof: 2 < 3 ==
+Hanc marginis exiguitas non caperet.
+QED
+!! result
+
+[edit] Proof: 2 < 3
+Hanc marginis exiguitas non caperet.
+QED
+
+!! end
+
+!! test
+Multiple tags in TOC
+!! input
+__TOC__
+== Foo Bar ==
+
+== Foo Bar
==
+!! result
+
+[edit] Foo Bar
+[edit] Foo Bar
+
+!! end
+
+!! test
+Tags with parameters in TOC
+!! input
+__TOC__
+== Hello ==
+
+== Evilbye ==
+!! result
+
+
+[edit] b">Evilbye
+
+!! end
!! article
MediaWiki:Bug32057
@@ -8895,6 +9176,15 @@ Strip marker in anchorencode
!! end
+!! test
+nowiki inside link inside heading (bug 18295)
+!! input
+==[[foo|xyz]]==
+!! result
+
+
+!! end
+
TODO:
more images
diff --git a/tests/parser/parserTestsParserHook.php b/tests/parser/parserTestsParserHook.php
index 324b8e5c..24d852c5 100644
--- a/tests/parser/parserTestsParserHook.php
+++ b/tests/parser/parserTestsParserHook.php
@@ -29,7 +29,7 @@ class ParserTestParserHook {
static function setup( &$parser ) {
$parser->setHook( 'tag', array( __CLASS__, 'dumpHook' ) );
-
+ $parser->setHook( 'statictag', array( __CLASS__, 'staticTagHook' ) );
return true;
}
@@ -43,4 +43,28 @@ class ParserTestParserHook {
return "\n$ret
";
}
+
+ static function staticTagHook( $in, $argv, $parser ) {
+ if ( ! count( $argv ) ) {
+ $parser->static_tag_buf = $in;
+ return '';
+ } elseif ( count( $argv ) === 1 && isset( $argv['action'] )
+ && $argv['action'] === 'flush' && $in === null )
+ {
+ // Clear the buffer, we probably don't need to
+ if ( isset( $parser->static_tag_buf ) ) {
+ $tmp = $parser->static_tag_buf;
+ } else {
+ $tmp = '';
+ }
+ $parser->static_tag_buf = null;
+ return $tmp;
+ } else
+ // wtf?
+ return
+ "\nCall this extension as string or as" .
+ " , not in any other way.\n" .
+ "text: " . var_export( $in, true ) . "\n" .
+ "argv: " . var_export( $argv, true ) . "\n";
+ }
}
diff --git a/tests/parser/parserTestsStaticParserHook.php b/tests/parser/parserTestsStaticParserHook.php
deleted file mode 100644
index e82f7f3f..00000000
--- a/tests/parser/parserTestsStaticParserHook.php
+++ /dev/null
@@ -1,58 +0,0 @@
-
- */
-
-class ParserTestStaticParserHook {
- static function setup( &$parser ) {
- $parser->setHook( 'statictag', array( __CLASS__, 'hook' ) );
-
- return true;
- }
-
- static function hook( $in, $argv, $parser ) {
- if ( ! count( $argv ) ) {
- $parser->static_tag_buf = $in;
- return '';
- } elseif ( count( $argv ) === 1 && isset( $argv['action'] )
- && $argv['action'] === 'flush' && $in === null )
- {
- // Clear the buffer, we probably don't need to
- if ( isset( $parser->static_tag_buf ) ) {
- $tmp = $parser->static_tag_buf;
- } else {
- $tmp = '';
- }
- $parser->static_tag_buf = null;
- return $tmp;
- } else
- // wtf?
- return
- "\nCall this extension as string or as" .
- " , not in any other way.\n" .
- "text: " . var_export( $in, true ) . "\n" .
- "argv: " . var_export( $argv, true ) . "\n";
- }
-}
diff --git a/tests/parser/preprocess/All_system_messages.expected b/tests/parser/preprocess/All_system_messages.expected
index 96d4569b..897c5fb0 100644
--- a/tests/parser/preprocess/All_system_messages.expected
+++ b/tests/parser/preprocess/All_system_messages.expected
@@ -1,4 +1,4 @@
-int:allmessagestext
+int:allmessagestext
<table border=1 width=100%><tr><td>
'''Name'''
diff --git a/tests/parser/preprocess/Factorial.expected b/tests/parser/preprocess/Factorial.expected
index 099029c0..a10fd6ca 100644
--- a/tests/parser/preprocess/Factorial.expected
+++ b/tests/parser/preprocess/Factorial.expected
@@ -1,4 +1,4 @@
-#expr:#ifeq:#expr:1>=00101#ifeq:#expr:1>=011*01#ifeq:#expr:1>=021*02#ifeq:#expr:1>=031*03#ifeq:#expr:1>=041*04#ifeq:#expr:1>=051*05#ifeq:#expr:1>=061*06#ifeq:#expr:1>=071*07#ifeq:#expr:1>=081*08#ifeq:#expr:1>=091*09#ifeq:#expr:1>=101*10#ifeq:#expr:1>=111*11#ifeq:#expr:1>=121*12#ifeq:#expr:1>=131*13#ifeq:#expr:1>=141*14#ifeq:#expr:1>=151*15#ifeq:#expr:1>=161*16#ifeq:#expr:1>=171*17#ifeq:#expr:1>=181*18#ifeq:#expr:1>=191*19#ifeq:#expr:1>=201*20#ifeq:#expr:1>=211*21#ifeq:#expr:1>=221*22#ifeq:#expr:1>=231*23#ifeq:#expr:1>=241*24#ifeq:#expr:1>=251*25#ifeq:#expr:1>=261*26#ifeq:#expr:1>=271*27#ifeq:#expr:1>=281*28#ifeq:#expr:1>=291*29#ifeq:#expr:1>=301*30#ifeq:#expr:1>=311*31#ifeq:#expr:1>=321*32#ifeq:#expr:1>=331*33#ifeq:#expr:1>=341*34#ifeq:#expr:1>=351*35#ifeq:#expr:1>=361*36#ifeq:#expr:1>=371*37#ifeq:#expr:1>=381*38#ifeq:#expr:1>=391*39#ifeq:#expr:1>=401*40#ifeq:#expr:1>=411*41#ifeq:#expr:1>=421*42#ifeq:#expr:1>=431*43#ifeq:#expr:1>=441*44#ifeq:#expr:1>=451*45#ifeq:#expr:1>=461*46#ifeq:#expr:1>=471*47#ifeq:#expr:1>=481*48#ifeq:#expr:1>=491*49#ifeq:#expr:1>=501*50#ifeq:#expr:1>=511*51#ifeq:#expr:1>=521*52#ifeq:#expr:1>=531*53#ifeq:#expr:1>=541*54#ifeq:#expr:1>=551*55#ifeq:#expr:1>=561*56#ifeq:#expr:1>=571*57#ifeq:#expr:1>=581*58#ifeq:#expr:1>=591*59#ifeq:#expr:1>=601*60#ifeq:#expr:1>=611*61#ifeq:#expr:1>=621*62#ifeq:#expr:1>=631*63#ifeq:#expr:1>=641*64#ifeq:#expr:1>=651*65#ifeq:#expr:1>=661*66#ifeq:#expr:1>=671*67#ifeq:#expr:1>=681*68#ifeq:#expr:1>=691*69#ifeq:#expr:1>=701*70#ifeq:#expr:1>=711*71#ifeq:#expr:1>=721*72#ifeq:#expr:1>=731*73#ifeq:#expr:1>=741*74#ifeq:#expr:1>=751*75#ifeq:#expr:1>=761*76#ifeq:#expr:1>=771*77#ifeq:#expr:1>=781*78#ifeq:#expr:1>=791*79#ifeq: