Skip to content

Commit f9a6933

Browse files
authored
add test for withCookies method in RedirectResponse (#47383)
1 parent 03106ae commit f9a6933

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/Http/HttpRedirectResponseTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@ public function testInputOnRedirect()
7575
$response->withInput();
7676
}
7777

78+
public function testWithCookies()
79+
{
80+
$response = new RedirectResponse('foo.bar');
81+
$response->setRequest(Request::create('/', 'GET', ['name' => 'Taylor', 'age' => 26]));
82+
$response->withCookies([
83+
new Cookie('name', 'milwad'),
84+
]);
85+
86+
$this->assertEquals('name', $response->headers->getCookies()[0]->getName());
87+
$this->assertEquals('milwad', $response->headers->getCookies()[0]->getValue());
88+
}
89+
7890
public function testOnlyInputOnRedirect()
7991
{
8092
$response = new RedirectResponse('foo.bar');

0 commit comments

Comments
 (0)