jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/378383 )

Change subject: Allow duplicate articles in parser tests with same content
......................................................................


Allow duplicate articles in parser tests with same content

Some extensions needs Template:(( in the parser tests,
but when using phpunit tests all pages are created at the begin,
which gives errors like
'duplicate article 'Template:((' at
/Arrays/arrayLoopsInteractionParserTests.txt:10

Change-Id: Iefa3dc8d647d58f2d5382b847bbd6228f46faff3
---
M tests/parser/ParserTestRunner.php
1 file changed, 12 insertions(+), 2 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified
  Jforrester: Looks good to me, but someone else must approve



diff --git a/tests/parser/ParserTestRunner.php 
b/tests/parser/ParserTestRunner.php
index 0121d53..149ba80 100644
--- a/tests/parser/ParserTestRunner.php
+++ b/tests/parser/ParserTestRunner.php
@@ -1592,11 +1592,21 @@
                        throw new MWException( "invalid title '$name' at 
$file:$line\n" );
                }
 
+               $newContent = ContentHandler::makeContent( $text, $title );
+
                $page = WikiPage::factory( $title );
                $page->loadPageData( 'fromdbmaster' );
 
                if ( $page->exists() ) {
-                       throw new MWException( "duplicate article '$name' at 
$file:$line\n" );
+                       $content = $page->getContent( Revision::RAW );
+                       // Only reject the title, if the content/content model 
is different.
+                       // This makes it easier to create Template:(( or 
Template:)) in different extensions
+                       if ( $newContent->equals( $content ) ) {
+                               return;
+                       }
+                       throw new MWException(
+                               "duplicate article '$name' with different 
content at $file:$line\n"
+                       );
                }
 
                // Use mock parser, to make debugging of actual parser tests 
simpler.
@@ -1606,7 +1616,7 @@
                $restore = $this->executeSetupSnippets( [ 'wgParser' => new 
ParserTestMockParser ] );
                try {
                        $status = $page->doEditContent(
-                               ContentHandler::makeContent( $text, $title ),
+                               $newContent,
                                '',
                                EDIT_NEW | EDIT_INTERNAL
                        );

-- 
To view, visit https://gerrit.wikimedia.org/r/378383
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iefa3dc8d647d58f2d5382b847bbd6228f46faff3
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <umherirrender_de...@web.de>
Gerrit-Reviewer: C. Scott Ananian <canan...@wikimedia.org>
Gerrit-Reviewer: Jackmcbarn <jackmcb...@gmail.com>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: Umherirrender <umherirrender_de...@web.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to