Page MenuHomePhabricator

phpunit failure: ParserTests::testParserTest for gallery and files with UploadWizard and data-file-*
Closed, ResolvedPublic

Description

These gallery tests don't like Special:Upload being replaced by Special:UploadWizard and data-file-* attributes being added. I thought there was some discussion already about this, but no bug was found for this test.

  1. ParserTests::testParserTest with data set #121 ('4. Indent-Pre and extension tags', ' a <gallery>

File:foobar.jpg
</gallery>', ' a <ul class="gallery mw-gallery-traditional">

<li class="gallerybox" style="width: 155px"><div style="width: 155px">
        <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
        <div class="gallerytext">
        </div>
</div></li>

</ul>
', '', '')

  1. Indent-Pre and extension tags

Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
' a <ul class="gallery mw-gallery-traditional">

<li class="gallerybox" style="width: 155px"><div style="width: 155px">

+ <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" data-file-width="1941" data-file-height="220" /></a></div></div>

        <div class="gallerytext">
        </div>
</div></li>

</ul>
'

/srv/vagrant/mediawiki/tests/phpunit/includes/parser/NewParserTest.php:767
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiTestCase.php:133
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:42
/srv/vagrant/mediawiki/tests/phpunit/phpunit.php:160

  1. ParserTests::testParserTest with data set #305 ('Link with double quotes in title part (literal) and alternate part (interpreted)', '[[File:Denys Savchenko \'\'Pentecoste\'\'.jpg]]

[[\'\'Pentecoste\'\']]

[[\'\'Pentecoste\'\'|Pentecoste]]

[[\'\'Pentecoste\'\'|\'\'Pentecoste\'\']]', '<p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
</p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="\'\'Pentecoste\'\' (page does not exist)">\'\'Pentecoste\'\'</a>
</p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="\'\'Pentecoste\'\' (page does not exist)">Pentecoste</a>
</p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="\'\'Pentecoste\'\' (page does not exist)"><i>Pentecoste</i></a>
</p>', '', '')
Link with double quotes in title part (literal) and alternate part (interpreted)
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'<p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
+'<p><a href="/wiki/Special:UploadWizard?wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
</p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
</p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
</p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
</p>'

/srv/vagrant/mediawiki/tests/phpunit/includes/parser/NewParserTest.php:767
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiTestCase.php:133
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:42
/srv/vagrant/mediawiki/tests/phpunit/phpunit.php:160

  1. ParserTests::testParserTest with data set #306 ('Broken image links with HTML captions (bug 39700)', '[[File:Nonexistent|<script></script>]]

[[File:Nonexistent|100px|<script></script>]]
[[File:Nonexistent|&lt;]]
[[File:Nonexistent|a<i>b</i>c]]', '<p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
<a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
<a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
<a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
</p>', '', '')
Broken image links with HTML captions (bug 39700)
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'<p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
-<a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
-<a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
-<a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
+'<p><a href="/wiki/Special:UploadWizard?wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
+<a href="/wiki/Special:UploadWizard?wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
+<a href="/wiki/Special:UploadWizard?wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
+<a href="/wiki/Special:UploadWizard?wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
</p>'

/srv/vagrant/mediawiki/tests/phpunit/includes/parser/NewParserTest.php:767
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiTestCase.php:133
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:42
/srv/vagrant/mediawiki/tests/phpunit/phpunit.php:160


Version: unspecified
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=67302

Details

Reference
bz68649

Event Timeline

bzimport raised the priority of this task from to Needs Triage.
bzimport set Reference to bz68649.
bzimport added a subscriber: Unknown Object (MLST).

Created attachment 16046
A bunch more similar failures

The discussion I remembered was this comment by Brion http://lists.wikimedia.org/pipermail/wikitech-l/2014-July/077481.html

Attached:

Also affects a Cite test:

  1. CiteParserTests::testParserTest with data set #7 ('<references> after <gallery> (bug 6164)', '<ref>one</ref>

<gallery>Image:Foobar.jpg</gallery>

<references/>', '<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
</p>
<ul class="gallery mw-gallery-traditional">

<li class="gallerybox" style="width: 155px"><div style="width: 155px">
        <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
        <div class="gallerytext">
        </div>
</div></li>

</ul>
<ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">one</span>
</li>
</ol>
', '', '')
<references> after <gallery> (bug 6164)
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
'<p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[1]</a></sup>
</p>
<ul class="gallery mw-gallery-traditional">

<li class="gallerybox" style="width: 155px"><div style="width: 155px">

+ <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" data-file-width="1941" data-file-height="220" /></a></div></div>

        <div class="gallerytext">
        </div>
</div></li>

</ul>
<ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><a href="#cite_ref-1">↑</a></span> <span class="reference-text">one</span>
</li>
</ol>
'

/srv/vagrant/mediawiki/tests/phpunit/includes/parser/NewParserTest.php:767
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiTestCase.php:133
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:42
/srv/vagrant/mediawiki/tests/phpunit/phpunit.php:160

Of course there is even more if one enables non-Wikimedia extensions, for instance data-bs-title attribute like <a href="/wiki/Special:BlankPage#autocomment" title="Special:BlankPage" data-bs-title="Special:BlankPage"> added probably by https://github.com/wikimedia/mediawiki-extensions-BlueSpiceFoundation/blob/master/includes/CoreHooks.php#L315

The issue is MultimediaViewer using a hook to inject data which I reported as bug 67302. Marking this bug as a duplicate.

  • This bug has been marked as a duplicate of bug 67302 ***