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

Writing maintainable unit tests


As the last part, before leaving the unit tests behind, I wanted to show some additional features provided by Codeception that have been already introduced in Chapter 1, The Testing Mindset.

Codeception has been created with modularity and flexibility in mind, so anything else is your responsibility. In particular, you might have already noticed that our UserTest class has grown quite a bit.

So, what would happen if a change in the interface or in the way our model works breaks our tests?

It's quite clear, especially if you're working in a team or even more if your code gets handed over to other people to maintain, that you need clear rules so that everybody agrees on how to write the code, as a starter, and tests.

I've already highlighted in Chapter 4, Isolated Component Testing with PHPUnit, that one of the very basic things I've started doing with the teams I've worked with and with my own code, is to define precise and simple rules, which aim at the clarity...