There was an error while loading. Please reload this page.
1 parent 19cae6e commit 2c7e6d6Copy full SHA for 2c7e6d6
2 files changed
system/Session/Session.php
@@ -274,6 +274,8 @@ private function removeOldSessionCookie(): void
274
public function destroy()
275
{
276
if (ENVIRONMENT === 'testing') {
277
+ $_SESSION = [];
278
+
279
return;
280
}
281
tests/system/Session/SessionTest.php
@@ -328,6 +328,19 @@ public function testSetMagicMethod(): void
328
$this->assertSame('bar', $_SESSION['foo']);
329
330
331
+ public function testDestroyClearsSessionInTesting(): void
332
+ {
333
+ $session = $this->getInstance();
334
+ $session->start();
335
336
+ $session->set('foo', 'bar');
337
+ $this->assertSame('bar', $_SESSION['foo']);
338
339
+ $session->destroy();
340
341
+ $this->assertSame([], $_SESSION);
342
+ }
343
344
public function testCanFlashData(): void
345
346
$session = $this->getInstance();
0 commit comments