Skip to content

Commit f0c1e73

Browse files
committed
Fix notifications controller test
1 parent 3e430bb commit f0c1e73

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

tests/TestCase/Controller/NotificationsControllerTest.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use App\Test\Fixture\IncidentsFixture;
88
use App\Test\Fixture\NotificationsFixture;
99
use App\Test\Fixture\ReportsFixture;
10+
use Cake\ORM\Query;
1011
use Cake\ORM\TableRegistry;
1112
use Cake\TestSuite\IntegrationTestTrait;
1213
use Cake\TestSuite\TestCase;
@@ -37,6 +38,7 @@ public function setUp(): void
3738
parent::setUp();
3839
$this->Notifications = TableRegistry::getTableLocator()->get('Notifications');
3940
$this->session(['Developer.id' => 1, 'read_only' => true]);
41+
$this->enableCsrfToken();
4042
}
4143

4244
public function testIndex(): void
@@ -61,12 +63,13 @@ public function testMassAction(): void
6163
],
6264
]
6365
);
66+
$this->assertResponseCode(302);
6467

6568
$notifications = $this->Notifications->find('all', fields: ['Notifications.id']);
66-
$this->assertInstanceOf('Cake\ORM\Query', $notifications);
69+
$this->assertInstanceOf(Query::class, $notifications);
6770
$actual = $notifications->enableHydration(false)->toArray();
6871
$expected = [
69-
['id' => '2'],
72+
['id' => 2],
7073
];
7174
$this->assertEquals($actual, $expected);
7275

@@ -75,9 +78,10 @@ public function testMassAction(): void
7578
'/notifications/mass_action',
7679
['mark_all' => 1]
7780
);
81+
$this->assertResponseCode(302);
7882

7983
$notifications = $this->Notifications->find('all', fields: ['Notifications.id']);
80-
$this->assertInstanceOf('Cake\ORM\Query', $notifications);
84+
$this->assertInstanceOf(Query::class, $notifications);
8185
$actual = $notifications->enableHydration(false)->toArray();
8286
$expected = [];
8387
$this->assertEquals($actual, $expected);

0 commit comments

Comments
 (0)