Chapter 10. Testing

In this chapter, we will cover:

  • Setting up the test framework
  • Creating fixtures and testing model methods
  • Testing controller actions and their views
  • Using mocks to test controllers
  • Running tests from the command line

Introduction

This chapter covers one of the most interesting areas of application programming: unit testing through CakePHP's built-in tools, which offers a complete and powerful unit testing framework.

The first recipe shows how to set up the test framework so that we can create our own test cases. The second recipe shows how to create test data (fixtures) and use that data to test model methods. The third and fourth recipes show how to test controller actions, and how to test that our views are showing what we expect. The last recipe shows how to run the test in a non-ordinary fashion.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.147.193