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 Count 布尔数组中真值的数量 2021-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01
- Laravel 仓库 2022-01-01
- 带有通配符的 Laravel 验证器 2021-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01
