双11狂欢大促

盲盒赢 定制羽绒服

开启惊喜盲盒,抽取你的专属好礼

— 惊喜奖品抢先看 —

如何升级PHPunit

渐行I渐远 渐行I渐远 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
自动化接口测试的php工程文件,安装了xampp、php5.6.21、phpunit3.7.21
想要升级成最新版本的phpunit但是网上通过pear方式升级根本行不通求教新的方法。

自己尝试的方法:
根据官网的手册https://phpunit.de/manual/current/zh_cn/installation.html
****************
Windows
整体上说,在 Windows 下安装 PHAR 和手工在 Windows 下安装 Composer 是一样的过程:
为 PHP 的二进制可执行文件建立一个目录,例如 C:\bin
将 ;C:\bin 附加到 PATH 环境变量中(相关帮助)
下载 https://phar.phpunit.de/phpunit.phar 并将文件保存到 C:\bin\phpunit.phar
打开命令行(例如,按 Windows+R » 输入 cmd » ENTER)
建立外包覆批处理脚本(最后得到 C:\bin\phpunit.cmd):

C:\Users\username> cd C:\bin
C:\bin> echo @php "%~dp0phpunit.phar" %* > phpunit.cmd
C:\bin> exit

新开一个命令行窗口,确认一下可以在任意路径下执行 PHPUnit:
C:\Users\username> phpunit --version
PHPUnit x.y.z by Sebastian Bergmann and contributors.

对于 Cygwin 或 MingW32 (例如 TortoiseGit) shell 环境,可以跳过第五步。 取而代之的是,把文件保存为 phpunit (没有 .phar 扩展名),然后用 chmod 775 phpunit 将其设为可执行。
Composer
如果用 Composer 来管理项目的依赖关系,只要在项目的 composer.json 文件中简单地加上对 phpunit/phpunit 的依赖关系即可。下面是一个最小化的 composer.json 文件的例子,只定义了一个对 PHPUnit 5.7 的开发时(development-time)依赖:


{
"require-dev": {
"phpunit/phpunit": "5.5.*"
}
}

要通过 Composer 完成系统级的安装,可以运行:

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

请确保 path 变量中包含有 ~/.composer/vendor/bin/。
*******************************
按照上述进行操作
但是:(dos显示)
C:\Users\Administrator>composer global require "phpunit/phpunit=5.7.*"
Changed current directory to C:/Users/Administrator/AppData/Roaming/Composer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 25 installs, 0 updates, 0 removals
- Installing symfony/yaml (v3.2.1) Downloading: 100%
- Installing sebastian/version (2.0.1) Downloading: 100%
- Installing sebastian/resource-operations (1.0.0) Downloading: 100%
- Installing sebastian/recursion-context (2.0.0) Downloading: 100%
- Installing sebastian/object-enumerator (2.0.0) Downloading: 100%
- Installing sebastian/global-state (1.1.1) Downloading: 100%
- Installing sebastian/exporter (2.0.0) Downloading: 100%
- Installing sebastian/environment (2.0.0) Downloading: 100%
- Installing sebastian/diff (1.4.1) Downloading: 100%
- Installing sebastian/comparator (1.2.2) Downloading: 100%
- Installing doctrine/instantiator (1.0.5) Downloading: 100%
- Installing phpunit/php-text-template (1.2.1) Downloading: 100%
- Installing phpunit/phpunit-mock-objects (3.4.3) Downloading: 100%
- Installing phpunit/php-timer (1.0.8) Downloading: 100%
- Installing phpunit/php-file-iterator (1.4.2) Downloading: 100%
- Installing sebastian/code-unit-reverse-lookup (1.0.0) Downloading: Connectin
Downloading: 100%
- Installing phpunit/php-token-stream (1.4.9) Downloading: 100%
- Installing phpunit/php-code-coverage (4.0.4) Downloading: 100%
- Installing webmozart/assert (1.2.0) Downloading: 100%
- Installing phpdocumentor/reflection-common (1.0) Downloading: 100%
- Installing phpdocumentor/type-resolver (0.2.1) Downloading: 100%
- Installing phpdocumentor/reflection-docblock (3.1.1) Downloading: Connecting
Downloading: 100%
- Installing phpspec/prophecy (v1.6.2) Downloading: 100%
- Installing myclabs/deep-copy (1.5.5) Downloading: 100%
- Installing phpunit/phpunit (5.7.5) Downloading: 100%
symfony/yaml suggests installing symfony/console (For validating YAML files usin
g the lint command)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit-mock-objects suggests installing ext-soap (*)
phpunit/php-code-coverage suggests installing ext-xdebug (>=2.4.0)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
phpunit/phpunit suggests installing ext-xdebug (*)
Writing lock file
Generating autoload files

C:\Users\Administrator>phpunit --version
PHPUnit 3.7.21 by Sebastian Bergmann.

phpunit已经下载了最新版本,却没安装?最后的版本还是3.7.21
而且我通过pear卸载phpunit但是还是能查到版本3.7.21
菜鸟不懂原理,求教
...全文

相关推荐

phpunit-speedtrap, 在PHPUnit测试套件中,报告缓慢运行的测试.zip

phpunit-speedtrap, 在PHPUnit测试套件中,报告缓慢运行的测试 phpunit-speedtrap SpeedTrap报告你的控制台中PHPUnit测试套件中运行缓慢的测试。影响测试执行时间的许多因素。 测试没有正确地从变量延迟( 数据库,网络,等等 ) 和测试机器上的基本负载隔离,将导致测试

weixin_38744153

PHPUnit PHP测试框架安装方法

单元测试是几个现代敏捷开发方法的基础,使得PHPUnit成为许多大型PHP项目的关键工具。这个工具也可以被Xdebug扩展用来生成代码覆盖率报告 ,并且可以与phing集成来自动测试,最后它还可以和Selenium整合来完成大型的自动化集成测试。 Windows平台LAMP环境XAMPP 1.7.3下如何安装PHPUnit呢? 首先,以管理员身份运行cmd,使用pear添加phpunit频道: D:\xampp\php>pear channel-discover pear.phpunit.de Channel “pear.phpunit.de” is already initialized 频

weixin_38622849

windows下安装pear及phpunit(注意配置好php命令行环境)

windows下安装pear及phpunit(注意配置好php命令行环境),需要的朋友可以参考下。

weixin_38500444

phpunit-orb:在CircleCI中运行PHPUnit Orb

PHPUnit CircleCI天体 一个用于运行测试的 。 用法 有关完整的使用指南,请参见。 版本控制 该项目符合。 变更日志 有关更改的完整列表以及如何在主要版本之间进行迁移,请参见。

林John

CentOS环境下安装PHPUnit的方法分析

主要介绍了CentOS环境下安装PHPUnit的方法,结合实例形式分析了CentOS环境下安装PHPUnit的步骤、相关问题与解决方法,需要的朋友可以参考下

weixin_38711333
评论 2
收藏 已收藏
分享
返回顶部
渐行I渐远
基础编程 21,889 成员 140,329 内容