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

Chapter 4. Isolated Component Testing with PHPUnit

In this chapter, we will take a closer look at PHPUnit and how it is handled by Codeception.

We will start with a brief introduction of the changes that we need to perform before getting into the actual tests, and from there, go through the red, green, and refactor phases to implement the tests and our code and refactor where needed.

We will introduce basic topics such as testing in isolation, integration tests of the components, and more advanced topics such as data providers.

The following topics are covered in this chapter:

  • Understanding the work to be done

  • Using the User model

  • Implementing the first unit test

  • Component testing of the model

  • Implementing the ActiveRecord class and its methods

  • Seeing test passing