Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 2eac047

Browse files
committed
Ensure that Set-Cookie header is not replaced
Although we have tests covering multiple `Set-Cookie` headers, they are not verifying if the function `header()` is being called correctly.
1 parent 529f527 commit 2eac047

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/Response/AbstractEmitterTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,24 @@ public function testEmitsMessageBody()
5656
$this->emitter->emit($response);
5757
}
5858

59+
public function testMultipleSetCookieHeadersAreNotReplaced()
60+
{
61+
$response = (new Response())
62+
->withStatus(200)
63+
->withAddedHeader('Set-Cookie', 'foo=bar')
64+
->withAddedHeader('Set-Cookie', 'bar=baz');
65+
66+
$this->emitter->emit($response);
67+
68+
$expectedStack = [
69+
['header' => 'HTTP/1.1 200 OK', 'replace' => true, 'status_code' => null],
70+
['header' => 'Set-Cookie: foo=bar', 'replace' => false, 'status_code' => null],
71+
['header' => 'Set-Cookie: bar=baz', 'replace' => false, 'status_code' => null],
72+
];
73+
74+
$this->assertSame($expectedStack, HeaderStack::stack());
75+
}
76+
5977
public function testDoesNotInjectContentLengthHeaderIfStreamSizeIsUnknown()
6078
{
6179
$stream = $this->prophesize('Psr\Http\Message\StreamInterface');

0 commit comments

Comments
 (0)