Skip to content

Commit 6f743e2

Browse files
authored
[9.x] Add tests for assertSessionHas in TestResponse (#41620)
1 parent 2519bab commit 6f743e2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/Testing/TestResponseTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,6 +1669,20 @@ public function testAssertSessionHasErrors()
16691669
$response->assertSessionHasErrors(['foo']);
16701670
}
16711671

1672+
public function testAssertSessionHas()
1673+
{
1674+
app()->instance('session.store', $store = new Store('test-session', new ArraySessionHandler(1)));
1675+
1676+
$store->put('foo', 'value');
1677+
$store->put('bar', 'value');
1678+
1679+
$response = TestResponse::fromBaseResponse(new Response());
1680+
1681+
$response->assertSessionHas('foo');
1682+
$response->assertSessionHas('bar');
1683+
$response->assertSessionHas(['foo', 'bar']);
1684+
}
1685+
16721686
public function testGetEncryptedCookie()
16731687
{
16741688
$container = Container::getInstance();

0 commit comments

Comments
 (0)