Skip to content

Commit 89db9e5

Browse files
authored
[9.x] Improve test forget,setPreviousUrl,PasswordConfirm in Store Class (#44446)
1 parent 758b805 commit 89db9e5

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/Session/SessionStoreTest.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,41 @@ public function testName()
441441
$this->assertSame('foo', $session->getName());
442442
}
443443

444+
public function testForget()
445+
{
446+
$session = $this->getSession();
447+
$session->put('foo', 'bar');
448+
$this->assertTrue($session->has('foo'));
449+
$session->forget('foo');
450+
$this->assertFalse($session->has('foo'));
451+
452+
$session->put('foo', 'bar');
453+
$session->put('bar', 'baz');
454+
$session->forget(['foo', 'bar']);
455+
$this->assertFalse($session->has('foo'));
456+
$this->assertFalse($session->has('bar'));
457+
}
458+
459+
public function testSetPreviousUrl()
460+
{
461+
$session = $this->getSession();
462+
$session->setPreviousUrl('https://example.com/foo/bar');
463+
464+
$this->assertTrue($session->has('_previous.url'));
465+
$this->assertSame('https://example.com/foo/bar', $session->get('_previous.url'));
466+
467+
$url = $session->previousUrl();
468+
$this->assertSame('https://example.com/foo/bar', $url);
469+
}
470+
471+
public function testPasswordConfirmed()
472+
{
473+
$session = $this->getSession();
474+
$this->assertFalse($session->has('auth.password_confirmed_at'));
475+
$session->passwordConfirmed();
476+
$this->assertTrue($session->has('auth.password_confirmed_at'));
477+
}
478+
444479
public function testKeyPush()
445480
{
446481
$session = $this->getSession();

0 commit comments

Comments
 (0)