Difference between revisions 1086003 and 1086013 on mediawikiwiki{{Manual:PHP_unit_testing/navigation}} You must have PHPUnit 3.7.0 (or later) installed to run the unit tests. Most developers use the very latest PHPUnit version, so there is no guarantee an older one will actually pass the tests we wrote. {{notice| Depending on your distribution and configuration, you may have to run the following commands with <code>sudo</code>. }} == Install methods == Several methods are available to you. Note the [[#Known issues|known issue below]], the Debian/Ubuntu package is broken. [http://phpunit.de/manual/current/en/installation.html The PHPUnit manual describes how to install it] by downloading the PHAR (recommended) or by using composer. Until [[bugzilla:64597|bug 64597]] is solved make sure to get a version 3.7 release, for which the download URL is: https://phar.phpunit.de/phpunit-lts.pharwhich will not work together with MediaWiki until [[bugzilla:58881|bug 58881]] is solved or by using composer. === MediaWiki PHPUnit installer === We provide a shell script for Unix-like operating systems (Ubuntu, Mac OS X, Linux...). The script will attempt to install PHPUnit using various methods and usually manage to get it installed. It will try [http://pear.php.net PEAR], falling back to the [[w:Advanced Packaging Tool|apt]] and [[w:Yellowdog Updater, Modified|yum]] package managers. The script is located in <tt>tests/phpunit</tt> and requires root access. Example installing PHPUnit under an Unix system: <source lang="bash"> $ cd tests/phpunit $ sudo ./install-phpunit.sh </source> This might be the easiest way to install PHPUnit. === Using PEAR === [https://github.com/sebastianbergmann/phpunit/wiki/End-of-Life-for-PEAR-Installation-Method Installing PHPUnit via PEAR is no longer supported .] But using the PHAR doesn't work together with MediaWiki until [[bugzilla:58881|bug 58881]] is solved. So this should still work. PEAR is a package manager for PHP, the MediaWiki PHPUnit installer attempt to use it as a first method. You will obviously need to install pear first. <syntaxhighlight lang="bash"> sudo pear channel-discover pear.phpunit.de sudo pear channel-discover components.ez.no sudo pear channel-discover pear.symfony-project.com sudo pear channel-discover pear.symfony.com sudo pear update-channels sudo pear install --alldeps phpunit/phpunit-3.7.35 </syntaxhighlight> If you're upgrading instead of installing, change the last line to: <syntaxhighlight lang="bash"> $ sudo pear upgrade --alldeps phpunit/PHPUnit </syntaxhighlight>⏎ == Testing your installation == <source lang="bash"> $ which phpunit /some/path/to/bin/phpunit $ phpunit --version PHPUnit A.B.C by Sebastian Bergmann. (contracted; show full)== Installation troubleshooting == If you get a version error after installation, for example... PHPUnit 3.6.7 or later required, you have 3.5.15. ...this means that you probably have more than one version of PHPUnit installed on your machine. You may need to edit your include_path in your php.ini file to point to the location of the newer installation. You may also need to add this path to the PATH variable in your .profile. == Notes == <references /> All content in the above text box is licensed under the Creative Commons Attribution-ShareAlike license Version 4 and was originally sourced from https://mediawiki.org/w/index.php?diff=prev&oldid=1086013.
![]() ![]() This site is not affiliated with or endorsed in any way by the Wikimedia Foundation or any of its affiliates. In fact, we fucking despise them.
|