Last modified: 2014-09-16 21:17:28 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T44174, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 42174 - Generated parser test class names should be unique
Generated parser test class names should be unique
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Unit tests (Other open bugs)
unspecified
All All
: Normal minor (vote)
: ---
Assigned To: Bawolff (Brian Wolff)
: easy
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-16 03:30 UTC by Daniel Friesen
Modified: 2014-09-16 21:17 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Daniel Friesen 2012-11-16 03:30:16 UTC
Inside of an extension create a parser tests file, name it parserTests.txt, and use $wgParserTestFiles[] = __DIR__ . '/parserTests.txt';

Running parserTests will work perfectly fine. However attempting to run unit tests will result in the following.

PHP Fatal error:  Cannot redeclare class ParserTests in {core}/tests/phpunit/includes/parser/MediaWikiParserTest.php(27) : eval()'d code on line 3

It appears that the phpunit parser test code makes really generic class names for parser test files based on the filename alone completely ignoring different paths.
Comment 1 Antoine "hashar" Musso (WMF) 2012-11-22 08:15:33 UTC
Rephrased to Parsertests generated class names are not unique. See implementation in phpunit/includes/parser/MediaWikiParserTest.php which uses basename(). Definitely easy to fix, just have to find out a new convention.
Comment 2 Gerrit Notification Bot 2013-06-05 16:13:34 UTC
Related URL: https://gerrit.wikimedia.org/r/67098 (Gerrit Change Idf14b4cbdb8ec103340d48855e0361acf707b101)
Comment 3 Nemo 2014-07-28 06:19:09 UTC
Thanks Bawolff for the patch, I just run into this as well.

PHP Fatal error:  Cannot redeclare class ParserTests in /srv/vagrant/mediawiki/tests/phpunit/includes/parser/MediaWikiParserTest.php(106) : eval()'d code on line 9
PHP Stack trace:
PHP   1. {main}() /srv/vagrant/mediawiki/tests/phpunit/phpunit.php:0
PHP   2. MediaWikiPHPUnitCommand::main() /srv/vagrant/mediawiki/tests/phpunit/phpunit.php:160
PHP   3. PHPUnit_TextUI_Command->run() /srv/vagrant/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:42
PHP   4. MediaWikiPHPUnitCommand->handleArguments() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:138
PHP   5. PHPUnit_TextUI_Command->handleArguments() /srv/vagrant/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:25
PHP   6. PHPUnit_Util_Configuration->getTestSuiteConfiguration() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:657
PHP   7. PHPUnit_Util_Configuration->getTestSuite() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Util/Configuration.php:797
PHP   8. PHPUnit_Framework_TestSuite->addTestFile() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Util/Configuration.php:912
PHP   9. ReflectionMethod->invoke() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:382
PHP  10. ExtensionsParserTestSuite::suite() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:382
PHP  11. MediaWikiParserTest::suite() /srv/vagrant/mediawiki/tests/phpunit/suites/ExtensionsParserTestSuite.php:5

Fatal error: Cannot redeclare class ParserTests in /srv/vagrant/mediawiki/tests/phpunit/includes/parser/MediaWikiParserTest.php(106) : eval()'d code on line 9
Comment 4 Gerrit Notification Bot 2014-09-16 20:47:22 UTC
Change 67098 merged by jenkins-bot:
Make generating Parser test class names more robust

https://gerrit.wikimedia.org/r/67098
Comment 5 Nemo 2014-09-16 21:17:28 UTC
Reedy CR ftw

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links