public function test_extend() { $headers = new HttpHeaders(['foo-bar' => 'baz']); $cookie = new Cookie('foo', 'bar'); $httpResponse = new HttpResponse(HttpStatusCode::NOT_FOUND, 'yolo', $headers); $httpResponse->getCookies()->add($cookie); $customResponse = new HttpResponse(); $customResponse->extend($httpResponse); $this->assertEquals($httpResponse->getStatusCode(), $customResponse->getStatusCode()); $this->assertEquals($httpResponse->getProtocol(), $customResponse->getProtocol()); $this->assertEquals($httpResponse->getProtocolVersion(), $customResponse->getProtocolVersion()); $this->assertEquals($httpResponse->getContent(), $customResponse->getContent()); $this->assertEquals($httpResponse->getContentType(), $customResponse->getContentType()); $this->assertEquals('baz', $customResponse->getHeaders()->find('foo-bar')); $this->assertFalse($customResponse->getHeaders() === $headers); $this->assertEquals('bar', $customResponse->getCookies()->findByName('foo')->getValue()); $this->assertFalse($customResponse->getCookies()->findByName('foo') === $cookie); }