Skip to content

Commit 02cbd34

Browse files
committed
Add tests for clearSession action
1 parent e96d65d commit 02cbd34

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/TestCase/Controller/ToolbarControllerTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,30 @@ public function testClearCache()
7070
$this->assertResponseOk();
7171
$this->assertResponseContains('success');
7272
}
73+
74+
/**
75+
* Test clearing the session does not work with GET
76+
*
77+
* @return void
78+
*/
79+
public function testClearSessionNoGet()
80+
{
81+
$this->get('/debug-kit/toolbar/clear-session');
82+
$this->assertResponseCode(405);
83+
}
84+
85+
/**
86+
* Test clearing the session.
87+
*
88+
* @return void
89+
*/
90+
public function testClearSession()
91+
{
92+
$this->session(['test' => 'value']);
93+
$this->configRequest(['headers' => ['Accept' => 'application/json']]);
94+
$this->post('/debug-kit/toolbar/clear-session');
95+
$this->assertResponseOk();
96+
$this->assertResponseContains('success');
97+
$this->assertResponseContains('Session cleared');
98+
}
7399
}

0 commit comments

Comments
 (0)