Conditions | 1 |
Paths | 1 |
Total Lines | 29 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | public function testMassAction() |
||
32 | { |
||
33 | /* Test case 1 */ |
||
34 | $this->post('/notifications/mass_action', |
||
35 | array('notifs' => array('1', '3')) |
||
36 | ); |
||
37 | |||
38 | $notifications = $this->Notifications->find('all', array('fields' => array('Notifications.id'))); |
||
39 | $this->assertInstanceOf('Cake\ORM\Query', $notifications); |
||
40 | $actual = $notifications->hydrate(false)->toArray(); |
||
41 | $expected = array( |
||
42 | array( |
||
43 | 'id' => '2', |
||
44 | ), |
||
45 | ); |
||
46 | $this->assertEquals($actual, $expected); |
||
47 | |||
48 | |||
49 | /* Test case 2 */ |
||
50 | $this->post('/notifications/mass_action', |
||
51 | array('mark_all' => 1) |
||
52 | ); |
||
53 | |||
54 | $notifications = $this->Notifications->find('all', array('fields' => array('Notifications.id'))); |
||
55 | $this->assertInstanceOf('Cake\ORM\Query', $notifications); |
||
56 | $actual = $notifications->hydrate(false)->toArray(); |
||
57 | $expected = array(); |
||
58 | $this->assertEquals($actual, $expected); |
||
59 | } |
||
60 | } |
||
61 |
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: