更新 PHPunit Xampp [英] Update PHPunit Xampp
问题描述
今天早上,我意识到 Xampp 提供的 PHPUnit 版本已经被弃用了很长一段时间.......版本 3.7.21.安装在 Xampp 中,但实际版本(在撰写本文时)是 6.0.13.
我尝试了在谷歌上提出的一些解决方案(所有旧的 5 年 + 解决方案),包括
当然,测试套件在我的生产服务器上还是兼容的(centos7,按照官方文档在Linux上更新
This morning, I realized that the version of PHPUnit supplied with Xampp has been deprecated for quite a while... . The version 3.7.21. installed in Xampp, but the actual version (at the time of this writing) is 6.0.13.
I tried some solution proposed on google (all old 5 years + solution), including
- https://wehuberconsultingllc.com/wordpress/2007/08/18/updating-phpunit-on-xampp/
- How to configure PhpUnit in Xampp?
- http://www.righthandedmonkey.com/2012/09/setting-up-phpunit-with-xampp.html
- http://forum.kohanaframework.org/discussion/7346/installing-phpunit-on-windows-xampp/p1
- ...
In any case, pear doesn't seem a viable solution. Is there a simple way to update PHPUnit in Xampp?
解决方案Actually, it can be updated in three simple steps:
- Download the last version of PHPUnit here: https://phpunit.de/index.html
- Copy "phpunit.phar" in "C:\xampp\php".
- In the file: "phpunit.bat", update the following line:
"%PHPBIN%" "C:\xampp\php\phpunit" %*
to :"%PHPBIN%" "C:\xampp\php\phpunit.phar" %
*
You don't need to restart apache.
Additional note: In your tests, you will need to replace:
phpunit_framework_testcase
by:TestCase
And include:
use PHPUnit\Framework\TestCase
at the top of your test files.Of course, the test suites are still compatible on my production server (centos7, follow the official documentation to update on Linux https://phpunit.de/getting-started.html).
这篇关于更新 PHPunit Xampp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!