CHAPTER 33

Images

CakePHP: Testing

Similar to the testing we did in Zend Framework, CakePHP’s unit tests depend on PHPUnit, making it an easy end to our time in CakePHP.

Goals

  • We need to learn how to create and run tests on our controllers.

Testing

There are a few simple tests that we can create in order to validate the functionality of our CakePHP controllers. Because the majority of code we have written in CakePHP concerns the controller, we will only write tests for some of the actions in the UsersController.

CakePHP unit tests need to be placed n the ~/app/Test/ directory, and the first set of tests that we will create are shown in Listing 33-1 ...

Get Pro PHP MVC now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.