Install PHPUNIT with Composer(使用 Composer 安装 PHPUNIT)
问题描述
我有 Symfony 2 的项目,我想在 Windows 7 上使用 PHPUNIT.
在 githut 上的 phpunit 是:作曲家如果您使用 Composer 管理项目的依赖项,只需将 phpunit/phpunit 的依赖项添加到项目的 composer.json 文件中.这是一个 composer.json 文件的最小示例,它仅定义了对 PHPUnit 3.7 的开发时依赖项:{需要开发":{phpunit/phpunit":3.7.*"}}对于通过 Composer 进行系统范围的安装,您可以运行:作曲家全局需要'phpunit/phpunit = 3.7.*'确保您的路径中有 ~/.composer/vendor/bin/.首先我使用系统范围的安装,但我不知道何时安装.接下来我添加到我的 composer.json 要求开发.这在 C:/wamp/www/myproject/vendor/symfony 中安装了 phpunit.接下来我尝试命令:
composer install --dev而且我不能使用 phpunit.在 cmd.exe 我输入phpunit",我有错误:
'phpunit' 不是内部或外部命令可运行程序或批处理文件我如何使用 phpunit?我有 Windows 7、Wamp 服务器和 php 5.4.12.
当你通过composer在windows中安装PHP-Unit时,全局安装会在其中创建文件
C:UsersYOUR_USERNAMEAppDataRoamingComposer要通过命令行轻松执行 phpunit,您需要在 windows 环境变量中添加 phpunit.bat 文件的路径.为此:
- 右击
我的电脑 - 转到
属性->高级系统设置和 - 点击
Advance标签中的Environment variables.
现在将 C:UsersYOUR_USERNAMEAppDataRoamingComposervendorin 添加到 windows PATH.
您现在可以从命令运行 phpunit.请注意,您可能需要重新启动命令提示符才能使更改生效.
I have project on Symfony 2 and i would like use PHPUNIT on Windows 7.
On githut phpunit is:
Composer
Simply add a dependency on phpunit/phpunit to your project's composer.json file if you use Composer to manage the dependencies of your project. Here is a minimal example of a composer.json file that just defines a development-time dependency on PHPUnit 3.7:
{
"require-dev": {
"phpunit/phpunit": "3.7.*"
}
}
For a system-wide installation via Composer, you can run:
composer global require 'phpunit/phpunit=3.7.*'
Make sure you have ~/.composer/vendor/bin/ in your path.
First i use system-wide installation but i dont know when this installed. Next i add to my composer.json require-dev. This installed phpunit in C:/wamp/www/myproject/vendor/symfony. Next i try commands:
composer install --dev
And i can't use phpunit. In cmd.exe i enter "phpunit" and i have error:
'phpunit' is not recognized as an internal or external command operable program or batch file
How can i use phpunit? I have Windows 7, Wamp server and php 5.4.12.
When you install PHP-Unit in windows via composer, the global installation will create files in
C:UsersYOUR_USERNAMEAppDataRoamingComposer
To execute phpunit easily via command line you need to add path of phpunit.bat file in windows Environment Variables. For this:
- Right click
My Computer- Go to
Properties -> Advance system settingsand- Click
Environment variablesfrom theAdvancetab.
Now add C:UsersYOUR_USERNAMEAppDataRoamingComposervendorin to the windows PATH.
You can now run the phpunit from command. Note that you may need to restart your command prompt for the changes to take effect.
这篇关于使用 Composer 安装 PHPUNIT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 Composer 安装 PHPUNIT
基础教程推荐
- PHP 类:全局变量作为类中的属性 2021-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- 如何替换eregi() 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
