O'Reilly logo

Learn CakePHP: With Unit Testing, Second Edition by Rādhārādhya Dāsa

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Sándor Gömöri 2016

Rādhārādhya Dāsa, Learn CakePHP, 10.1007/978-1-4842-1212-7_9

9. Controller Tests 1

Rādhārādhya Dāsa

(1)Somogyvamos, Hungary

A337704_2_En_9_Figa_HTML.jpg

Yes, learning by trying and doing is the root of coding

In chapter 7, you saw that model tests extend TestCase. Controller tests extend IntegrationTestCase. Using this as base classes will simulate get, post calls, and check for response objects.

Overview of the Baked Controller

Take a look at the /src/Controllers/PostsController.php file that we generated by bake earlier.

 1   <?php               2   namespace App\Controller;               3                 

All controllers share the same namespace, which is App\Controller.

 4   use App\Controller\AppController; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required