test-environment-setup.md 1.39 KB
Newer Older
1 2
Testing environment setup
======================
Ragazzo committed
3 4 5

> Note: This section is under development.

6 7
Yii2 has officially maintained integration with [`Codeception`](https://github.com/Codeception/Codeception) testing
framework that allows you to create the following test types:
Ragazzo committed
8 9 10 11 12

- [Unit testing](test-unit.md) - verifies that a single unit of code is working as expected;
- [Functional testing](test-functional.md) - verifies scenarios from a user's perspective via browser emulation;
- [Acceptance testing](test-acceptance.md) - verifies scenarios from a user's perspective in a browser.

13 14 15
Yii provides ready to use test sets for all three test types in both
[`yii2-basic`](https://github.com/yiisoft/yii2/tree/master/apps/basic) and
[`yii2-advanced`](https://github.com/yiisoft/yii2/tree/master/apps/advanced) application templates.
Ragazzo committed
16

17 18
In order to run tests you need to install [Codeception](https://github.com/Codeception/Codeception). A good way to
install it is the following:
Ragazzo committed
19 20 21 22 23 24 25

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

26
If you've never used Composer for global packages before, run `composer global status`. It should output:
Ragazzo committed
27 28 29 30 31 32 33

```
Changed current directory to <directory>
```

Then add `<directory>/vendor/bin` to you `PATH` environment variable. Now we're able to use `codecept` from command
line globally.