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 5. Summoning the Test Doubles

In this chapter, we are going to take a close look at test doubles in order to control our tests with more accuracy and avoid having to rely on interfaces we don't know anything about.

We're going to complete the work we started in the previous chapter and understand how to deal with external dependencies, particularly the difference between stubs and mocks.

We will then spend the rest of the chapter on understanding how to organize our tests to improve legibility and maintainability, using some BDD-oriented tools we've introduced earlier in the book, such as Specify and Verify.

On a high level, these are the topics that we will cover in this chapter:

  • Dealing with external dependencies

  • Isolating components with stubs

  • Listening for calls with an observer

  • Writing maintainable unit tests