© Sándor Gömöri 2016

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

8. Model Tests

Rādhārādhya Dāsa

(1)Somogyvamos, Hungary

A337704_2_En_8_Figa_HTML.jpg

We’re big fans of fat models

OK. I won’t torture you anymore. Let’s write our first unit test.

Use the following sample code in your UserFixture.php file.

 1  <?php             2  namespace App\Test\Fixture;             3               4  use Cake\TestSuite\Fixture\TestFixture;             5               6  class UsersFixture extends TestFixture             7  {             8               9     public $import = ['model' => 'Users'];             10                  11     public $records = [             12          [             13              'id' => 1,             14              'username' => 'rrd',             15              'password' => 'Gouranga',             16              'role' ...

Get Learn CakePHP: With Unit Testing, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.