今天早上,我意识到Xampp提供的PHPUnit版本已经被废弃了一段时间了.。版本3.7.21。安装在Xampp中,但实际版本(撰写本文时)为6.0.13。
我尝试了一些在google上提出的解决方案(所有老的5年+解决方案),包括
无论如何,pear似乎不是一个可行的解决方案。有没有一种简单的方法来更新Xampp中的PHPUnit?
发布于 2017-04-03 15:16:53
实际上,它可以通过三个简单的步骤进行更新:
"%PHPBIN%" "C:\xampp\php\phpunit" %*到:"%PHPBIN%" "C:\xampp\php\phpunit.phar" %*您不需要重新启动apache。
附加注意事项:在您的测试中,您需要替换:phpunit_framework_testcase by:TestCase
包括:测试文件顶部的use PHPUnit\Framework\TestCase。

当然,测试套件在我的生产服务器上仍然是兼容的(centos7,按照官方文档在Linux https://phpunit.de/getting-started.html上进行更新)。

发布于 2019-08-23 15:37:47
谢谢,XAMPP v7.3.7的工作还不错
最新的phpunit.phar可以从:https://phar.phpunit.de下载。
发布于 2020-08-04 22:38:22
我有类似的问题,并找到了不同的解决办法。我已经安装了带有composer globaly的phpunit
composer global require phpunit/phpunit "^9"在我的项目中本地化(两个版本都是"^9")。
cd C:/fullpath/to/myproject
composer require-dev phpunit/phpunit "^9"但是,由于某种原因,从xampp文件夹中触发了phpunit。所以我的所作所为被删除了
phpunit
phpunit.bat来自C:\xampp\php,对我来说很管用。
只需记住在Windows中将composer路径设置为env路径。
现在,您可以在项目根目录中创建phpunit.xml (以下是对我有用的内容):
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.0/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
testdox="true"
verbose="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
forceCoversAnnotation="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
stopOnRisky="false">
<testsuites>
<testsuite name="default">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>然后只需将cd转到根目录,然后在我的终端中运行phpunit,以便从tests文件夹运行所有测试。
希望你能找到有用的信息。

*编辑: Hypper.js -在Windows 10上使用Git (万一您想知道)
https://stackoverflow.com/questions/43188374
复制相似问题