Book Image

Learning Yii Testing

Book Image

Learning Yii Testing

Overview of this book

Table of Contents (16 chapters)
Learning Yii Testing
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Functional tests in Yii 2


As you saw in Chapter 3, Entering Codeception, we have some basic functional tests preloaded in our basic application.

Let's start digging into that and once you acquire the required knowledge, we're going to move on to the tests for the REST interface.

As you know, the basic application is composed of a few pages, a login system, and a contact form.

The functional tests cover almost everything, so let's start to see what files we have and what's their content.

Understanding and improving the available CEPTs

The tests contained in codeception/functional/HomeCept.php are quite straightforward to understand. Thanks to the syntax used by Codeception, you can easily understand what the intention of the test is, so let's break it down and see what each bit does:

$I = new FunctionalTester($scenario);

You would start by initializing the actor under which the tests will be performed. Yii uses a slightly different naming than the one officially used in the documentation and guide...