Now that we've seen what we can theoretically do with Codeception, let's move on and install it.
Yii comes with its own Codeception extension that provides a base class for unit tests (yii\codeception\TestCase
), a class for tests that require database interaction (yii\codeception\DbTestCase
), and a base class for Codeception page objects (yii\codeception\BasePage
).
As usual, our preferred method is using Composer:
$ composer require "codeception/codeception: 2.0.*" --prefer-dist --dev
There's a specific reason to use –prefer-dist
; if you're using Git, you can get into a hairy situation with Git submodules (but again excluding the /vendor
folder should solve most of these problems). To avoid repeating it every time we use Composer, just add the following to your composer.json
file:
// composer.json { "config": { "preferred-install": "dist" } }
Also, remember that using composer install
will not work if you've added the component manually to your...