for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Test\TestCase\Controller;
use Cake\ORM\TableRegistry;
use Cake\TestSuite\IntegrationTestCase;
/**
* NotificationsController Test Case.
*/
class NotificationsControllerTest extends IntegrationTestCase
{
* Fixtures.
*
* @var array
public $fixtures = array(
'app.notifications',
'app.developers',
'app.reports',
'app.incidents',
);
public function setUp()
$this->Notifications = TableRegistry::get('Notifications');
Notifications
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
$this->session(array('Developer.id' => 1));
}
public function testMassAction()
/* Test case 1 */
$this->post('/notifications/mass_action',
array('notifs' => array('1', '3'))
$notifications = $this->Notifications->find('all', array('fields' => array('Notifications.id')));
$this->assertInstanceOf('Cake\ORM\Query', $notifications);
$actual = $notifications->hydrate(false)->toArray();
$expected = array(
array(
'id' => '2',
),
$this->assertEquals($actual, $expected);
/* Test case 2 */
array('mark_all' => 1)
$expected = array();
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: