Codeception Testing with Yii Framework 2.0 [Day 2]

Today’s Objective

As a user I would like to run tests on the basic template for Yii Framework.


I have a few things already set up that I would like to state for the record:

Installing Basic Yii Template

With those items installed, let’s begin with installing Yii (Thorough instructions here).

First we inform composer of the required global package we will need (Only need to do this once)

composer global require "fxp/composer-asset-plugin:1.0.0"

Then we create the project (using Yii’s basic template), you should run this command in your www folder of WampServer (For me it’s C:\wamp\www)

composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic codeception-test

The last piece of that is the project name, in this case it’s ‘conception-test’ and now I have a folder codeception-test in C:\wamp\www, and Yii is installed!

Installing Codeception

With Yii up and running, we’ll need Codeception installed to execute tests:

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

With Codeception downloaded, we need to be able to run it from the command line by adding the path of Composer’s global vendor\bin directory, to get Composer’s global director we run the following:

composer global status

That command shows the following:

Changed current directory to C:/Users/<user>/AppData/Roaming/Composer

Now we add “C:\Users\<user>\AppData\Roaming\Composer\vendor\bin” to PATH for Windows Advanced system settings. Once done you should be able to run the following without an error:


You may need to restart your command line session for the changes to take effect.


Alrightey, we now have Codeception set up for use and a basic Yii application set up to execute tests on. I would’ve liked to at least execute a test by now, but haven’t made a lot of progress with this current method of describing/detailing the process involved. Think I will be making it far more shorthand in future posts and actually complete the objective before writing.

Signing off for now, the objective should be done tomorrow ;)


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>