简体   繁体   English

Yii2:使用Composer安装Codeception和phpunit并使用它

[英]Yii2: install codeception and phpunit with composer and use it

System: Win7 ,64Bit 系统:Win7,64Bit

I installed yii2 with composer. 我用作曲家安装了yii2。 And I also tried to install codeception and phpunit by composer using these commands 我还尝试使用这些命令由作曲家安装Codeception和phpunit

composer global require "phpunit/phpunit=4.3.*"
composer global require "codeception/codeception=2.0.*"
composer global require "codeception/specify=*"
composer global require "codeception/verify=*"

I also added teh phpunit to the composer.json 我也将phpunit添加到composer.json

 "require-dev": {
    "yiisoft/yii2-codeception": "*",
    "yiisoft/yii2-debug": "*",
    "yiisoft/yii2-gii": "*",
    "yiisoft/yii2-faker": "*",
    "phpunit/phpunit": "4.3.*"
},

and added current Path to the PATH environment variable 并将当前路径添加到PATH环境变量

E:\wamp\www\website\vendor\bin

But if I run 但是如果我跑步

phpunit --version

or 要么

codeception

I get the Error message "The command 'phpunit' wasn't found... 我收到错误消息“找不到命令'phpunit'...

I am sure that E:\\wamp\\www\\website\\vendor\\bin does not contain any phpunit or codeception files. 我确定E:\\ wamp \\ www \\ website \\ vendor \\ bin不包含任何phpunit或代码接收文件。 Because you have installed phpunit and codeception globally, it means that they are installed someplace else and not in the website files (and that makes sense too). 因为您已全局安装了phpunit和codeception,所以这意味着它们已安装在其他位置,而不是安装在网站文件中(这也很有意义)。

Here are some instructions on how to add composer globally in Windows Is there any way to install Composer globally on Windows? 以下是有关如何在Windows中全局添加Composer的一些说明。 有什么方法可以在Windows上全局安装Composer? .

I do not have windows so I cannot tell you directly where things are. 我没有窗户,所以我不能直接告诉你东西在哪里。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM