Last modified: 2014-08-02 14:32:53 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 T66597, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 64597 - Support PHPUnit 4.x and higher (phpunit.php fails with "Version.php not found")
Support PHPUnit 4.x and higher (phpunit.php fails with "Version.php not found")
Status: RESOLVED DUPLICATE of bug 58881
Product: MediaWiki
Classification: Unclassified
Unit tests (Other open bugs)
unspecified
All All
: Normal major with 2 votes (vote)
: 1.24.0 release
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-04-29 11:42 UTC by physikerwelt
Modified: 2014-08-02 14:32 UTC (History)
9 users (show)

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


Attachments

Description physikerwelt 2014-04-29 11:42:21 UTC
I have set a up a new VM with latest versions of vagrant and virtualbox to reproduce an error originally reported by Etienne.
running vagrant up worked without issues and installed phpunit 4.0.17 from pear. (Which will be unsupported from Dec'14 on)
However, the phpunit.php file within mediawiki does not work. See error messsage below:

vagrant@mediawiki-vagrant:/vagrant/mediawiki/tests/phpunit$ ./phpunit.php --version
PHP Warning:  require_once(PHPUnit/Runner/Version.php): failed to open stream: No such file or directory in /vagrant/mediawiki/tests/phpunit/phpunit.php on line 108
PHP Stack trace:
PHP   1. {main}() /vagrant/mediawiki/tests/phpunit/phpunit.php:0

Warning: require_once(PHPUnit/Runner/Version.php): failed to open stream: No such file or directory in /vagrant/mediawiki/tests/phpunit/phpunit.php on line 108

Call Stack:
    0.0020     680640   1. {main}() /vagrant/mediawiki/tests/phpunit/phpunit.php:0

PHP Fatal error:  require_once(): Failed opening required 'PHPUnit/Runner/Version.php' (include_path='.:/usr/share/php:/usr/share/pear') in /vagrant/mediawiki/tests/phpunit/phpunit.php on line 108
PHP Stack trace:
PHP   1. {main}() /vagrant/mediawiki/tests/phpunit/phpunit.php:0

Fatal error: require_once(): Failed opening required 'PHPUnit/Runner/Version.php' (include_path='.:/usr/share/php:/usr/share/pear') in /vagrant/mediawiki/tests/phpunit/phpunit.php on line 108

Call Stack:
    0.0020     680640   1. {main}() /vagrant/mediawiki/tests/phpunit/phpunit.php:0


vagrant@mediawiki-vagrant:/vagrant/mediawiki/tests/phpunit$ phpunit --version
PHPUnit 4.0.17 by Sebastian Bergmann.

You have installed PHPUnit via PEAR. This installation method is no longer
supported and http://pear.phpunit.de/ will be shut down no later than
December, 31 2014.

Please read http://phpunit.de/manual/current/en/installation.html and
learn how to use PHPUnit from a PHAR or install it via Composer.
Comment 1 physikerwelt 2014-05-06 12:04:01 UTC
Can anyone reproduce this problem?
Comment 2 Tisza Gergő 2014-05-08 23:54:38 UTC
Just ran into it. MediaWiki tries to require PHPUnit files directly, but the phpunit/phpunit PEAR channel now falls back to the PHAR method (install a single file, /usr/bin/phpunit, with all classes packed inside it).

After extracting manually, I get "Failed opening required 'PHPUnit/Autoload.php'", which suggests that fixing this will not be as simple as changing the installation method.

On a related note, the testing framework should be vendorized and included with the application, not left to the reuser to figure out which version to install and how. Now that MediaWiki is getting Composer support, this should be easy to do.
Comment 3 Tisza Gergő 2014-05-08 23:58:28 UTC
Autoloader.php was indeed removed from PHPUnit with 4.0. I assume it relies on Composer now to generate an autoloader on the fly.
Comment 4 Tisza Gergő 2014-05-09 00:02:01 UTC
As a temporary fix, you can downgrade to the last pre-4.x version:

  pear uninstall phpunit/PHPUnit
  pear install phpunit/PHPUnit-3.7.35
Comment 5 Gerrit Notification Bot 2014-05-09 10:12:30 UTC
Change 132377 had a related patch set uploaded by Physikerwelt:
Fix PHPUnit version to 3.7.35

https://gerrit.wikimedia.org/r/132377
Comment 6 Gerrit Notification Bot 2014-05-10 11:24:43 UTC
Change 132377 merged by jenkins-bot:
Fix PHPUnit version to 3.7.35

https://gerrit.wikimedia.org/r/132377
Comment 7 physikerwelt 2014-05-10 11:36:21 UTC
Please keep in mind that this is a "temporary fix".

https://github.com/sebastianbergmann/phpunit/wiki/End-of-Life-for-PEAR-Installation-Method
Comment 8 physikerwelt 2014-06-03 08:14:19 UTC
It would be nice if someone could assign her/himself to work on this problem... the end of the year seems to be far now... but suddenly it will be very close;-)
Comment 9 Tisza Gergő 2014-06-03 20:25:52 UTC
Given https://gerrit.wikimedia.org/r/#/c/132788/ , can't we just define PHPUnit as a dev dependency and have mw-vagrant run composer install --dev when it checks out mediawiki/core?
Comment 10 Krinkle 2014-06-03 20:36:02 UTC
Rephrased summary.

The problem is that MediaWiki is trying to include the PHPUnit source files (from a global php import_path) directly. This method is last supported by PHPUnit 3.7.

When using PHPUnit 4.x or later, this no longer works and users are unable to run the MediaWiki phpunit tests.
Comment 11 Antoine "hashar" Musso (WMF) 2014-08-02 14:32:53 UTC
This is a duplicate of bug 58881 can't use phpunit.phar to invoke MediaWiki tests

There is a bunch of patches in Gerrit attached to that bug which adds support for loading the .phar.

*** This bug has been marked as a duplicate of bug 58881 ***

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


Navigation
Links