PhlyTest\Http\ServerTest::testEmitsHeadersWithMultipleValuesMultipleTimes PHP Method

testEmitsHeadersWithMultipleValuesMultipleTimes() public method

    public function testEmitsHeadersWithMultipleValuesMultipleTimes()
    {
        $server = ['HTTP_HOST' => 'example.com', 'REQUEST_METHOD' => 'GET', 'REQUEST_URI' => '/foo/bar'];
        $callback = function ($req, $res) {
            $res = $res->withAddedHeader('Content-Type', 'text/plain');
            $res = $res->withAddedHeader('Set-Cookie', 'foo=bar; expires=Wed, 1 Oct 2014 10:30; path=/foo; domain=example.com');
            $res = $res->withAddedHeader('Set-Cookie', 'bar=baz; expires=Wed, 8 Oct 2014 10:30; path=/foo/bar; domain=example.com');
            return $res;
        };
        $server = Server::createServer($callback, $server, [], [], [], []);
        $server->listen();
        ob_end_flush();
        $this->assertContains('HTTP/1.1 200 OK', HeaderStack::stack());
        $this->assertContains('Content-Type: text/plain', HeaderStack::stack());
        $this->assertContains('Set-Cookie: foo=bar; expires=Wed, 1 Oct 2014 10:30; path=/foo; domain=example.com', HeaderStack::stack());
        $this->assertContains('Set-Cookie: bar=baz; expires=Wed, 8 Oct 2014 10:30; path=/foo/bar; domain=example.com', HeaderStack::stack());
        $stack = HeaderStack::stack();
        return $stack;
    }