X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fparser%2FPreprocessorTest.php;h=fb1311809172a3a1fdf0aaa312482cbb35abae5c;hb=b36d883017982f9642fea4513cc7273561fba38c;hp=8b83b674aa66baf7774ceef731deeafee559c5c6;hpb=b5f6fcb087098ac6f5e2f80c0e84b790bc44da16;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/parser/PreprocessorTest.php b/tests/phpunit/includes/parser/PreprocessorTest.php index 8b83b674aa..fb13118091 100644 --- a/tests/phpunit/includes/parser/PreprocessorTest.php +++ b/tests/phpunit/includes/parser/PreprocessorTest.php @@ -18,7 +18,7 @@ class PreprocessorTest extends MediaWikiTestCase { return array( 'gallery', 'display map' /* Used by Maps, see r80025 CR */, '/foo' ); } - function provideCases() { + public static function provideCases() { return array( array( "Foo", "Foo" ), array( "", "<!-- Foo -->" ), @@ -52,16 +52,16 @@ class PreprocessorTest extends MediaWikiTestCase { array( "Foo\n=\n==\n=\n", "Foo\n=\n==\n=\n" ), array( "{{Foo}}", "" ), array( "\n{{Foo}}", "\n" ), - array( "{{Foo|bar}}", "" ), - array( "{{Foo|bar}}a", "a" ), - array( "{{Foo|bar|baz}}", "" ), + array( "{{Foo|bar}}", "" ), + array( "{{Foo|bar}}a", "a" ), + array( "{{Foo|bar|baz}}", "" ), array( "{{Foo|1=bar}}", "" ), array( "{{Foo|=bar}}", "" ), - array( "{{Foo|bar=baz}}", "" ), + array( "{{Foo|bar=baz}}", "" ), array( "{{Foo|{{bar}}=baz}}", "" ), - array( "{{Foo|1=bar|baz}}", "" ), + array( "{{Foo|1=bar|baz}}", "" ), array( "{{Foo|1=bar|2=baz}}", "" ), - array( "{{Foo|bar|foo=baz}}", "" ), + array( "{{Foo|bar|foo=baz}}", "" ), array( "{{{1}}}", "1" ), array( "{{{1|}}}", "1" ), array( "{{{Foo}}}", "Foo" ), @@ -84,26 +84,26 @@ class PreprocessorTest extends MediaWikiTestCase { array( "Foo ", "Foo gallery bar="baz" " ), array( "Foo ", "Foo gallery bar="1" baz=2 " ), array( "Foo", "/fooFoo<//foo>" ), # Worth blacklisting IMHO - array( "{{#ifexpr: ({{{1|1}}} = 2) | Foo | Bar }}", ""), - array( "{{#if: {{{1|}}} | Foo | {{Bar}} }}", ""), - array( "{{#if: {{{1|}}} | Foo | [[Bar]] }}", ""), - array( "{{#if: {{{1|}}} | [[Foo]] | Bar }}", ""), - array( "{{#if: {{{1|}}} | 1 | {{#if: {{{1|}}} | 2 | 3 }} }}", ""), - array( "{{ {{Foo}}", "{{ "), - array( "{{Foobar {{Foo}} {{Bar}} {{Baz}} ", "{{Foobar "), - array( "[[Foo]] |", "[[Foo]] |"), - array( "{{Foo|Bar|", "{{Foo|Bar|"), - array( "[[Foo]", "[[Foo]"), - array( "[[Foo|Bar]", "[[Foo|Bar]"), - array( "{{Foo| [[Bar] }}", "{{Foo| [[Bar] }}"), - array( "{{Foo| [[Bar|Baz] }}", "{{Foo| [[Bar|Baz] }}"), - array( "{{Foo|bar=[[baz]}}", "{{Foo|bar=[[baz]}}"), - array( "{{foo|", "{{foo|"), - array( "{{foo|}", "{{foo|}"), - array( "{{foo|} }}", ""), - array( "{{foo|bar=|}", "{{foo|bar=|}"), - array( "{{Foo|} Bar=", "{{Foo|} Bar="), - array( "{{Foo|} Bar=}}", ""), + array( "{{#ifexpr: ({{{1|1}}} = 2) | Foo | Bar }}", "" ), + array( "{{#if: {{{1|}}} | Foo | {{Bar}} }}", "" ), + array( "{{#if: {{{1|}}} | Foo | [[Bar]] }}", "" ), + array( "{{#if: {{{1|}}} | [[Foo]] | Bar }}", "" ), + array( "{{#if: {{{1|}}} | 1 | {{#if: {{{1|}}} | 2 | 3 }} }}", "" ), + array( "{{ {{Foo}}", "{{ " ), + array( "{{Foobar {{Foo}} {{Bar}} {{Baz}} ", "{{Foobar " ), + array( "[[Foo]] |", "[[Foo]] |" ), + array( "{{Foo|Bar|", "{{Foo|Bar|" ), + array( "[[Foo]", "[[Foo]" ), + array( "[[Foo|Bar]", "[[Foo|Bar]" ), + array( "{{Foo| [[Bar] }}", "{{Foo| [[Bar] }}" ), + array( "{{Foo| [[Bar|Baz] }}", "{{Foo| [[Bar|Baz] }}" ), + array( "{{Foo|bar=[[baz]}}", "{{Foo|bar=[[baz]}}" ), + array( "{{foo|", "{{foo|" ), + array( "{{foo|}", "{{foo|}" ), + array( "{{foo|} }}", "" ), + array( "{{foo|bar=|}", "{{foo|bar=|}" ), + array( "{{Foo|} Bar=", "{{Foo|} Bar=" ), + array( "{{Foo|} Bar=}}", "" ), /* array( file_get_contents( __DIR__ . '/QuoteQuran.txt' ), file_get_contents( __DIR__ . '/QuoteQuranExpanded.txt' ) ), */ ); } @@ -148,12 +148,13 @@ class PreprocessorTest extends MediaWikiTestCase { /** * These are more complex test cases taken out of wiki articles. */ - function provideFiles() { + public static function provideFiles() { return array( array( "QuoteQuran" ), # http://en.wikipedia.org/w/index.php?title=Template:QuoteQuran/sandbox&oldid=237348988 GFDL + CC-BY-SA by Striver array( "Factorial" ), # http://en.wikipedia.org/w/index.php?title=Template:Factorial&oldid=98548758 GFDL + CC-BY-SA by Polonium array( "All_system_messages" ), # http://tl.wiktionary.org/w/index.php?title=Suleras:All_system_messages&oldid=2765 GPL text generated by MediaWiki array( "Fundraising" ), # http://tl.wiktionary.org/w/index.php?title=MediaWiki:Sitenotice&oldid=5716 GFDL + CC-BY-SA, copied there by Sky Harbor. + array( "NestedTemplates" ), # bug 27936 ); } @@ -179,8 +180,8 @@ class PreprocessorTest extends MediaWikiTestCase { /** * Tests from Bug 28642 · https://bugzilla.wikimedia.org/28642 */ - function provideHeadings() { - return array( /* These should become headings: */ + public static function provideHeadings() { + return array( /* These should become headings: */ array( "== h ==", "== h ==<!--c1-->" ), array( "== h == ", "== h == <!--c1-->" ), array( "== h == ", "== h ==<!--c1--> " ), @@ -226,4 +227,3 @@ class PreprocessorTest extends MediaWikiTestCase { $this->assertEquals( $this->normalizeXml( $expectedXml ), $this->preprocessToXml( $wikiText ) ); } } -