mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-14 22:30:27 +08:00
Update test-environment-setup.md
This commit is contained in:
@ -1,8 +1,6 @@
|
|||||||
配置测试环境
|
测试环境设置
|
||||||
======================
|
======================
|
||||||
|
|
||||||
> 注意:本章节内容还在开发中
|
|
||||||
|
|
||||||
Yii 2 官方兼容 [`Codeception`](https://github.com/Codeception/Codeception) 测试框架,
|
Yii 2 官方兼容 [`Codeception`](https://github.com/Codeception/Codeception) 测试框架,
|
||||||
你可以创建以下类型的测试:
|
你可以创建以下类型的测试:
|
||||||
|
|
||||||
@ -14,36 +12,12 @@ Yii 为包括 [`yii2-basic`](https://github.com/yiisoft/yii2/tree/master/apps/ba
|
|||||||
[`yii2-advanced`](https://github.com/yiisoft/yii2/tree/master/apps/advanced)
|
[`yii2-advanced`](https://github.com/yiisoft/yii2/tree/master/apps/advanced)
|
||||||
在内的应用模板脚手架提供全部三种类型的即用测试套件。
|
在内的应用模板脚手架提供全部三种类型的即用测试套件。
|
||||||
|
|
||||||
为了运行测试用例,你需要安装 [Codeception](https://github.com/Codeception/Codeception) 。
|
Codeception 预装了基本和高级项目模板。
|
||||||
一个较好的安装方式是:
|
如果您没有使用这些模板中的一个,则可以安装 Codeception
|
||||||
|
通过输入以下控制台命令:
|
||||||
For the local installation use following commands:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
composer require-dev "codeception/codeception=*"
|
composer require codeception/codeception
|
||||||
composer require-dev "codeception/specify=*"
|
composer require codeception/specify
|
||||||
composer require-dev "codeception/verify=*"
|
composer require codeception/verify
|
||||||
```
|
```
|
||||||
|
|
||||||
For the global installation you will need to use `global` directive:
|
|
||||||
|
|
||||||
```
|
|
||||||
composer global require "codeception/codeception=*"
|
|
||||||
composer global require "codeception/specify=*"
|
|
||||||
composer global require "codeception/verify=*"
|
|
||||||
```
|
|
||||||
|
|
||||||
如果你从未通过 Composer 安装过全局的扩展包,运行 `composer global status` 。你的窗口应该输出类似如下:
|
|
||||||
|
|
||||||
```
|
|
||||||
Changed current directory to <directory>
|
|
||||||
```
|
|
||||||
|
|
||||||
然后,将 `<directory>/vendor/bin` 增加到你的 `PATH` 环境变量中。现在,
|
|
||||||
我们可以在命令行中全局的使用 `codecept` 命令了。
|
|
||||||
|
|
||||||
> 注意:global installation allows you use Codeception for all projects you are working on your development machine and
|
|
||||||
allows running `codecept` shell command globally without specifying path. However, such approach may be inappropriate,
|
|
||||||
for example, if 2 different projects require different versions of Codeception installed.
|
|
||||||
For the simplicity all shell commands related to the tests running around this guide are written assuming Codeception
|
|
||||||
has been installed globally.
|
|
||||||
|
Reference in New Issue
Block a user