在 windows 上安装 phpunit

Install phpunit on windows(在 windows 上安装 phpunit)
本文介绍了在 windows 上安装 phpunit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

如何安装phpunit?

How to install phpunit?

我阅读了文档 https://github.com/sebastianbergmann/phpunit,但有一个错误:

I read documentation https://github.com/sebastianbergmann/phpunit, but have an error:

>pear upgrade PEAR
Nothing to upgrade

>pear config-set auto_discover 1
config-set succeeded

>pear install pear.phpunit.de/PHPUnit
No releases available for package "pear.phpunit.de/PHPUnit"
install failed

我该如何解决这个错误?

How can I fix this error?

推荐答案

旧答案 (2014):据说从 2014 年 12 月起,phpunit 将无法通过 PEAR 使用.
所以使用 composer 很容易安装:

Old answer (2014): It's said that phpunit will not be available via PEAR since December 2014.
So it's easy to install it using composer:

composer global require "phpunit/phpunit=4.1.*"

更新 2019:它应该作为本地(对于您的项目)开发包安装:

Update 2019: it should be installed as a local (for your project) development package:

 composer require --dev phpunit/phpunit ^8

2020 年更新:它应该作为本地(对于您的项目)开发包安装:作曲家需要 --dev phpunit/phpunit ^9.3

Update 2020: it should be installed as a local (for your project) development package: composer require --dev phpunit/phpunit ^9.3

这篇关于在 windows 上安装 phpunit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Subtract time in PHP(在 PHP 中减去时间)
Limit execution time of an function or command PHP(限制函数或命令 PHP 的执行时间)
How to sum N number of time (HH:MM Format)?(如何求和 N 次(HH:MM 格式)?)
How to get current time in milliseconds in PHP?(如何在 PHP 中以毫秒为单位获取当前时间?)
How to check if time is between two times in PHP(如何检查时间是否在 PHP 中的两次之间)
Convert number of minutes into hours amp; minutes using PHP(将分钟数转换为小时数分钟使用 PHP)