Book Image

Mastering Yii

By : Charles R. Portwood ll
Book Image

Mastering Yii

By: Charles R. Portwood ll

Overview of this book

The successor of Yii Framework 1.1, Yii 2 is a complete rewrite of Yii Framework, one of the most popular PHP 5 frameworks around for making modern web applications. The update embraces the best practices and protocols established with newer versions of PHP, while still maintaining the simple, fast, and extendable behavior found in its predecessor. This book has been written to enhance your skills and knowledge with Yii Framework 2. Starting with configuration and how to initialize new projects, you’ll learn how to configure, manage, and use every aspect of Yii2 from Gii, DAO, Query Builder, Active Record, and migrations, to asset manager. You'll also discover how to automatically test your code using codeception. With this book by your side, you’ll have all the skills you need to quickly create rich modern web and console applications with Yii 2.
Table of Contents (20 chapters)
Mastering Yii
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
5
Modules, Widgets, and Helpers
13
Debugging and Deploying
Index

Chapter 10. Testing with Codeception

An important but often overlooked aspect of software development is testing our application to ensure that it performs as expected. There are three basic ways in which we can test our applications:

  • Unit testing

  • Functional testing

  • Acceptance testing

Unit testing enables us to test individual sections of code before coupling it with our application. Functional testing allows us to test the functional aspects of code within a simulated browser, and acceptance testing allows us to test our application within a real browser and verify that it does what we built it to do. With Yii2, we can use a tool called Codeception to create and execute unit, functional, and acceptance testing for our application. In this chapter, we'll cover how to create and run unit, functional, and acceptance testing in Yii2. In addition to these three types of testing, we can mock our data using fixtures, which we can use to bring our application to a fixed state before testing.

Tip

As...