429 lines
26 KiB
YAML
429 lines
26 KiB
YAML
name: ResponseTest
|
|
class_comment: '# * @group time-sensitive'
|
|
dependencies:
|
|
- name: Cookie
|
|
type: class
|
|
source: Symfony\Component\HttpFoundation\Cookie
|
|
- name: Request
|
|
type: class
|
|
source: Symfony\Component\HttpFoundation\Request
|
|
- name: Response
|
|
type: class
|
|
source: Symfony\Component\HttpFoundation\Response
|
|
properties: []
|
|
methods:
|
|
- name: testPrepareDoesNotSetContentTypeBasedOnRequestAcceptHeader
|
|
visibility: public
|
|
parameters: []
|
|
comment: "# * @group time-sensitive\n# */\n# class ResponseTest extends ResponseTestCase\n\
|
|
# {\n# public function testToString()\n# {\n# $response = new Response();\n# $response\
|
|
\ = explode(\"\\r\\n\", $response);\n# $this->assertEquals('HTTP/1.0 200 OK',\
|
|
\ $response[0]);\n# $this->assertEquals('Cache-Control: no-cache, private', $response[1]);\n\
|
|
# }\n# \n# public function testClone()\n# {\n# $response = new Response();\n#\
|
|
\ $responseClone = clone $response;\n# $this->assertEquals($response, $responseClone);\n\
|
|
# }\n# \n# public function testSendHeaders()\n# {\n# $response = new Response();\n\
|
|
# $headers = $response->sendHeaders();\n# $this->assertSame($response, $headers);\n\
|
|
# }\n# \n# public function testSendInformationalResponse()\n# {\n# $response =\
|
|
\ new Response();\n# $response->sendHeaders(103);\n# \n# // Informational responses\
|
|
\ must not override the main status code\n# $this->assertSame(200, $response->getStatusCode());\n\
|
|
# \n# $response->sendHeaders();\n# }\n# \n# public function testSend()\n# {\n\
|
|
# $response = new Response();\n# $responseSend = $response->send();\n# $this->assertSame($response,\
|
|
\ $responseSend);\n# }\n# \n# public function testGetCharset()\n# {\n# $response\
|
|
\ = new Response();\n# $charsetOrigin = 'UTF-8';\n# $response->setCharset($charsetOrigin);\n\
|
|
# $charset = $response->getCharset();\n# $this->assertEquals($charsetOrigin, $charset);\n\
|
|
# }\n# \n# public function testIsCacheable()\n# {\n# $response = new Response();\n\
|
|
# $this->assertFalse($response->isCacheable());\n# }\n# \n# public function testIsCacheableWithErrorCode()\n\
|
|
# {\n# $response = new Response('', 500);\n# $this->assertFalse($response->isCacheable());\n\
|
|
# }\n# \n# public function testIsCacheableWithNoStoreDirective()\n# {\n# $response\
|
|
\ = new Response();\n# $response->headers->set('cache-control', 'private');\n\
|
|
# $this->assertFalse($response->isCacheable());\n# }\n# \n# public function testIsCacheableWithSetTtl()\n\
|
|
# {\n# $response = new Response();\n# $response->setTtl(10);\n# $this->assertTrue($response->isCacheable());\n\
|
|
# }\n# \n# public function testMustRevalidate()\n# {\n# $response = new Response();\n\
|
|
# $this->assertFalse($response->mustRevalidate());\n# }\n# \n# public function\
|
|
\ testMustRevalidateWithMustRevalidateCacheControlHeader()\n# {\n# $response =\
|
|
\ new Response();\n# $response->headers->set('cache-control', 'must-revalidate');\n\
|
|
# \n# $this->assertTrue($response->mustRevalidate());\n# }\n# \n# public function\
|
|
\ testMustRevalidateWithProxyRevalidateCacheControlHeader()\n# {\n# $response\
|
|
\ = new Response();\n# $response->headers->set('cache-control', 'proxy-revalidate');\n\
|
|
# \n# $this->assertTrue($response->mustRevalidate());\n# }\n# \n# public function\
|
|
\ testSetNotModified()\n# {\n# $response = new Response('foo');\n# $modified =\
|
|
\ $response->setNotModified();\n# $this->assertSame($response, $modified);\n#\
|
|
\ $this->assertEquals(304, $modified->getStatusCode());\n# \n# ob_start();\n#\
|
|
\ $modified->sendContent();\n# $string = ob_get_clean();\n# $this->assertEmpty($string);\n\
|
|
# }\n# \n# public function testIsSuccessful()\n# {\n# $response = new Response();\n\
|
|
# $this->assertTrue($response->isSuccessful());\n# }\n# \n# public function testIsNotModified()\n\
|
|
# {\n# $response = new Response();\n# $modified = $response->isNotModified(new\
|
|
\ Request());\n# $this->assertFalse($modified);\n# }\n# \n# public function testIsNotModifiedNotSafe()\n\
|
|
# {\n# $request = Request::create('/homepage', 'POST');\n# \n# $response = new\
|
|
\ Response();\n# $this->assertFalse($response->isNotModified($request));\n# }\n\
|
|
# \n# public function testIsNotModifiedLastModified()\n# {\n# $before = 'Sun,\
|
|
\ 25 Aug 2013 18:32:31 GMT';\n# $modified = 'Sun, 25 Aug 2013 18:33:31 GMT';\n\
|
|
# $after = 'Sun, 25 Aug 2013 19:33:31 GMT';\n# \n# $request = new Request();\n\
|
|
# $request->headers->set('If-Modified-Since', $modified);\n# \n# $response = new\
|
|
\ Response();\n# \n# $response->headers->set('Last-Modified', $modified);\n# $this->assertTrue($response->isNotModified($request));\n\
|
|
# \n# $response->headers->set('Last-Modified', $before);\n# $this->assertTrue($response->isNotModified($request));\n\
|
|
# \n# $response->headers->set('Last-Modified', $after);\n# $this->assertFalse($response->isNotModified($request));\n\
|
|
# \n# $response->headers->set('Last-Modified', '');\n# $this->assertFalse($response->isNotModified($request));\n\
|
|
# }\n# \n# public function testIsNotModifiedEtag()\n# {\n# $etagOne = 'randomly_generated_etag';\n\
|
|
# $etagTwo = 'randomly_generated_etag_2';\n# \n# $request = new Request();\n#\
|
|
\ $request->headers->set('If-None-Match', \\sprintf('%s, %s, %s', $etagOne, $etagTwo,\
|
|
\ 'etagThree'));\n# \n# $response = new Response();\n# \n# $response->headers->set('ETag',\
|
|
\ $etagOne);\n# $this->assertTrue($response->isNotModified($request));\n# \n#\
|
|
\ $response->headers->set('ETag', $etagTwo);\n# $this->assertTrue($response->isNotModified($request));\n\
|
|
# \n# $response->headers->set('ETag', '');\n# $this->assertFalse($response->isNotModified($request));\n\
|
|
# \n# // Test wildcard\n# $request = new Request();\n# $request->headers->set('If-None-Match',\
|
|
\ '*');\n# \n# $response->headers->set('ETag', $etagOne);\n# $this->assertTrue($response->isNotModified($request));\n\
|
|
# }\n# \n# public function testIsNotModifiedWeakEtag()\n# {\n# $etag = 'randomly_generated_etag';\n\
|
|
# $weakEtag = 'W/randomly_generated_etag';\n# \n# $request = new Request();\n\
|
|
# $request->headers->set('If-None-Match', $etag);\n# $response = new Response();\n\
|
|
# \n# $response->headers->set('ETag', $etag);\n# $this->assertTrue($response->isNotModified($request));\n\
|
|
# \n# $response->headers->set('ETag', $weakEtag);\n# $this->assertTrue($response->isNotModified($request));\n\
|
|
# \n# $request->headers->set('If-None-Match', $weakEtag);\n# $response = new Response();\n\
|
|
# \n# $response->headers->set('ETag', $etag);\n# $this->assertTrue($response->isNotModified($request));\n\
|
|
# \n# $response->headers->set('ETag', $weakEtag);\n# $this->assertTrue($response->isNotModified($request));\n\
|
|
# }\n# \n# public function testIsNotModifiedLastModifiedAndEtag()\n# {\n# $before\
|
|
\ = 'Sun, 25 Aug 2013 18:32:31 GMT';\n# $modified = 'Sun, 25 Aug 2013 18:33:31\
|
|
\ GMT';\n# $after = 'Sun, 25 Aug 2013 19:33:31 GMT';\n# $etag = 'randomly_generated_etag';\n\
|
|
# \n# $request = new Request();\n# $request->headers->set('If-None-Match', \\\
|
|
sprintf('%s, %s', $etag, 'etagThree'));\n# $request->headers->set('If-Modified-Since',\
|
|
\ $modified);\n# \n# $response = new Response();\n# \n# $response->headers->set('ETag',\
|
|
\ $etag);\n# $response->headers->set('Last-Modified', $after);\n# $this->assertTrue($response->isNotModified($request));\n\
|
|
# \n# $response->headers->set('ETag', 'non-existent-etag');\n# $response->headers->set('Last-Modified',\
|
|
\ $before);\n# $this->assertFalse($response->isNotModified($request));\n# \n#\
|
|
\ $response->headers->set('ETag', $etag);\n# $response->headers->set('Last-Modified',\
|
|
\ $modified);\n# $this->assertTrue($response->isNotModified($request));\n# }\n\
|
|
# \n# public function testIsNotModifiedIfModifiedSinceAndEtagWithoutLastModified()\n\
|
|
# {\n# $modified = 'Sun, 25 Aug 2013 18:33:31 GMT';\n# $etag = 'randomly_generated_etag';\n\
|
|
# \n# $request = new Request();\n# $request->headers->set('If-None-Match', \\\
|
|
sprintf('%s, %s', $etag, 'etagThree'));\n# $request->headers->set('If-Modified-Since',\
|
|
\ $modified);\n# \n# $response = new Response();\n# \n# $response->headers->set('ETag',\
|
|
\ $etag);\n# $this->assertTrue($response->isNotModified($request));\n# \n# $response->headers->set('ETag',\
|
|
\ 'non-existent-etag');\n# $this->assertFalse($response->isNotModified($request));\n\
|
|
# }\n# \n# public function testIfNoneMatchWithoutETag()\n# {\n# $request = new\
|
|
\ Request();\n# $request->headers->set('If-None-Match', 'randomly_generated_etag');\n\
|
|
# \n# $this->assertFalse((new Response())->isNotModified($request));\n# \n# //\
|
|
\ Test wildcard\n# $request = new Request();\n# $request->headers->set('If-None-Match',\
|
|
\ '*');\n# \n# $this->assertFalse((new Response())->isNotModified($request));\n\
|
|
# }\n# \n# public function testIsValidateable()\n# {\n# $response = new Response('',\
|
|
\ 200, ['Last-Modified' => $this->createDateTimeOneHourAgo()->format(\\DATE_RFC2822)]);\n\
|
|
# $this->assertTrue($response->isValidateable(), '->isValidateable() returns true\
|
|
\ if Last-Modified is present');\n# \n# $response = new Response('', 200, ['ETag'\
|
|
\ => '\"12345\"']);\n# $this->assertTrue($response->isValidateable(), '->isValidateable()\
|
|
\ returns true if ETag is present');\n# \n# $response = new Response();\n# $this->assertFalse($response->isValidateable(),\
|
|
\ '->isValidateable() returns false when no validator is present');\n# }\n# \n\
|
|
# public function testGetDate()\n# {\n# $oneHourAgo = $this->createDateTimeOneHourAgo();\n\
|
|
# $response = new Response('', 200, ['Date' => $oneHourAgo->format(\\DATE_RFC2822)]);\n\
|
|
# $date = $response->getDate();\n# $this->assertEquals($oneHourAgo->getTimestamp(),\
|
|
\ $date->getTimestamp(), '->getDate() returns the Date header if present');\n\
|
|
# \n# $response = new Response();\n# $date = $response->getDate();\n# $this->assertEquals(time(),\
|
|
\ $date->getTimestamp(), '->getDate() returns the current Date if no Date header\
|
|
\ present');\n# \n# $response = new Response('', 200, ['Date' => $this->createDateTimeOneHourAgo()->format(\\\
|
|
DATE_RFC2822)]);\n# $now = $this->createDateTimeNow();\n# $response->headers->set('Date',\
|
|
\ $now->format(\\DATE_RFC2822));\n# $date = $response->getDate();\n# $this->assertEquals($now->getTimestamp(),\
|
|
\ $date->getTimestamp(), '->getDate() returns the date when the header has been\
|
|
\ modified');\n# \n# $response = new Response('', 200);\n# $now = $this->createDateTimeNow();\n\
|
|
# $response->headers->remove('Date');\n# $date = $response->getDate();\n# $this->assertEquals($now->getTimestamp(),\
|
|
\ $date->getTimestamp(), '->getDate() returns the current Date when the header\
|
|
\ has previously been removed');\n# }\n# \n# public function testGetMaxAge()\n\
|
|
# {\n# $response = new Response();\n# $response->headers->set('Cache-Control',\
|
|
\ 's-maxage=600, max-age=0');\n# $this->assertEquals(600, $response->getMaxAge(),\
|
|
\ '->getMaxAge() uses s-maxage cache control directive when present');\n# \n#\
|
|
\ $response = new Response();\n# $response->headers->set('Cache-Control', 'max-age=600');\n\
|
|
# $this->assertEquals(600, $response->getMaxAge(), '->getMaxAge() falls back to\
|
|
\ max-age when no s-maxage directive present');\n# \n# $response = new Response();\n\
|
|
# $response->headers->set('Cache-Control', 'must-revalidate');\n# $response->headers->set('Expires',\
|
|
\ $this->createDateTimeOneHourLater()->format(\\DATE_RFC2822));\n# $this->assertEquals(3600,\
|
|
\ $response->getMaxAge(), '->getMaxAge() falls back to Expires when no max-age\
|
|
\ or s-maxage directive present');\n# \n# $response = new Response();\n# $response->headers->set('Expires',\
|
|
\ -1);\n# $this->assertSame(0, $response->getMaxAge());\n# \n# $response = new\
|
|
\ Response();\n# $this->assertNull($response->getMaxAge(), '->getMaxAge() returns\
|
|
\ null if no freshness information available');\n# }\n# \n# public function testSetSharedMaxAge()\n\
|
|
# {\n# $response = new Response();\n# $response->setSharedMaxAge(20);\n# \n# $cacheControl\
|
|
\ = $response->headers->get('Cache-Control');\n# $this->assertEquals('public,\
|
|
\ s-maxage=20', $cacheControl);\n# }\n# \n# public function testSetStaleIfError()\n\
|
|
# {\n# $response = new Response();\n# $response->setSharedMaxAge(20);\n# $response->setStaleIfError(86400);\n\
|
|
# \n# $cacheControl = $response->headers->get('Cache-Control');\n# $this->assertEquals('public,\
|
|
\ s-maxage=20, stale-if-error=86400', $cacheControl);\n# }\n# \n# public function\
|
|
\ testSetStaleWhileRevalidate()\n# {\n# $response = new Response();\n# $response->setSharedMaxAge(20);\n\
|
|
# $response->setStaleWhileRevalidate(300);\n# \n# $cacheControl = $response->headers->get('Cache-Control');\n\
|
|
# $this->assertEquals('public, s-maxage=20, stale-while-revalidate=300', $cacheControl);\n\
|
|
# }\n# \n# public function testSetStaleIfErrorWithoutSharedMaxAge()\n# {\n# $response\
|
|
\ = new Response();\n# $response->setStaleIfError(86400);\n# \n# $cacheControl\
|
|
\ = $response->headers->get('Cache-Control');\n# $this->assertEquals('stale-if-error=86400,\
|
|
\ private', $cacheControl);\n# }\n# \n# public function testSetStaleWhileRevalidateWithoutSharedMaxAge()\n\
|
|
# {\n# $response = new Response();\n# $response->setStaleWhileRevalidate(300);\n\
|
|
# \n# $cacheControl = $response->headers->get('Cache-Control');\n# $this->assertEquals('stale-while-revalidate=300,\
|
|
\ private', $cacheControl);\n# }\n# \n# public function testIsPrivate()\n# {\n\
|
|
# $response = new Response();\n# $response->headers->set('Cache-Control', 'max-age=100');\n\
|
|
# $response->setPrivate();\n# $this->assertEquals(100, $response->headers->getCacheControlDirective('max-age'),\
|
|
\ '->isPrivate() adds the private Cache-Control directive when set to true');\n\
|
|
# $this->assertTrue($response->headers->getCacheControlDirective('private'), '->isPrivate()\
|
|
\ adds the private Cache-Control directive when set to true');\n# \n# $response\
|
|
\ = new Response();\n# $response->headers->set('Cache-Control', 'public, max-age=100');\n\
|
|
# $response->setPrivate();\n# $this->assertEquals(100, $response->headers->getCacheControlDirective('max-age'),\
|
|
\ '->isPrivate() adds the private Cache-Control directive when set to true');\n\
|
|
# $this->assertTrue($response->headers->getCacheControlDirective('private'), '->isPrivate()\
|
|
\ adds the private Cache-Control directive when set to true');\n# $this->assertFalse($response->headers->hasCacheControlDirective('public'),\
|
|
\ '->isPrivate() removes the public Cache-Control directive');\n# }\n# \n# public\
|
|
\ function testExpire()\n# {\n# $response = new Response();\n# $response->headers->set('Cache-Control',\
|
|
\ 'max-age=100');\n# $response->expire();\n# $this->assertEquals(100, $response->headers->get('Age'),\
|
|
\ '->expire() sets the Age to max-age when present');\n# \n# $response = new Response();\n\
|
|
# $response->headers->set('Cache-Control', 'max-age=100, s-maxage=500');\n# $response->expire();\n\
|
|
# $this->assertEquals(500, $response->headers->get('Age'), '->expire() sets the\
|
|
\ Age to s-maxage when both max-age and s-maxage are present');\n# \n# $response\
|
|
\ = new Response();\n# $response->headers->set('Cache-Control', 'max-age=5, s-maxage=500');\n\
|
|
# $response->headers->set('Age', '1000');\n# $response->expire();\n# $this->assertEquals(1000,\
|
|
\ $response->headers->get('Age'), '->expire() does nothing when the response is\
|
|
\ already stale/expired');\n# \n# $response = new Response();\n# $response->expire();\n\
|
|
# $this->assertFalse($response->headers->has('Age'), '->expire() does nothing\
|
|
\ when the response does not include freshness information');\n# \n# $response\
|
|
\ = new Response();\n# $response->headers->set('Expires', -1);\n# $response->expire();\n\
|
|
# $this->assertNull($response->headers->get('Age'), '->expire() does not set the\
|
|
\ Age when the response is expired');\n# \n# $response = new Response();\n# $response->headers->set('Expires',\
|
|
\ date(\\DATE_RFC2822, time() + 600));\n# $response->expire();\n# $this->assertNull($response->headers->get('Expires'),\
|
|
\ '->expire() removes the Expires header when the response is fresh');\n# }\n\
|
|
# \n# public function testNullExpireHeader()\n# {\n# $response = new Response(null,\
|
|
\ 200, ['Expires' => null]);\n# $this->assertNull($response->getExpires());\n\
|
|
# }\n# \n# public function testGetTtl()\n# {\n# $response = new Response();\n\
|
|
# $this->assertNull($response->getTtl(), '->getTtl() returns null when no Expires\
|
|
\ or Cache-Control headers are present');\n# \n# $response = new Response();\n\
|
|
# $response->headers->set('Expires', $this->createDateTimeOneHourLater()->format(\\\
|
|
DATE_RFC2822));\n# $this->assertEquals(3600, $response->getTtl(), '->getTtl()\
|
|
\ uses the Expires header when no max-age is present');\n# \n# $response = new\
|
|
\ Response();\n# $response->headers->set('Expires', $this->createDateTimeOneHourAgo()->format(\\\
|
|
DATE_RFC2822));\n# $this->assertSame(0, $response->getTtl(), '->getTtl() returns\
|
|
\ zero when Expires is in past');\n# \n# $response = new Response();\n# $response->headers->set('Expires',\
|
|
\ $response->getDate()->format(\\DATE_RFC2822));\n# $response->headers->set('Age',\
|
|
\ 0);\n# $this->assertSame(0, $response->getTtl(), '->getTtl() correctly handles\
|
|
\ zero');\n# \n# $response = new Response();\n# $response->headers->set('Cache-Control',\
|
|
\ 'max-age=60');\n# $this->assertEquals(60, $response->getTtl(), '->getTtl() uses\
|
|
\ Cache-Control max-age when present');\n# }\n# \n# public function testSetClientTtl()\n\
|
|
# {\n# $response = new Response();\n# $response->setClientTtl(10);\n# \n# $this->assertEquals($response->getMaxAge(),\
|
|
\ $response->getAge() + 10);\n# }\n# \n# public function testGetSetProtocolVersion()\n\
|
|
# {\n# $response = new Response();\n# \n# $this->assertEquals('1.0', $response->getProtocolVersion());\n\
|
|
# \n# $response->setProtocolVersion('1.1');\n# \n# $this->assertEquals('1.1',\
|
|
\ $response->getProtocolVersion());\n# }\n# \n# public function testGetVary()\n\
|
|
# {\n# $response = new Response();\n# $this->assertEquals([], $response->getVary(),\
|
|
\ '->getVary() returns an empty array if no Vary header is present');\n# \n# $response\
|
|
\ = new Response();\n# $response->headers->set('Vary', 'Accept-Language');\n#\
|
|
\ $this->assertEquals(['Accept-Language'], $response->getVary(), '->getVary()\
|
|
\ parses a single header name value');\n# \n# $response = new Response();\n# $response->headers->set('Vary',\
|
|
\ 'Accept-Language User-Agent X-Foo');\n# $this->assertEquals(['Accept-Language',\
|
|
\ 'User-Agent', 'X-Foo'], $response->getVary(), '->getVary() parses multiple header\
|
|
\ name values separated by spaces');\n# \n# $response = new Response();\n# $response->headers->set('Vary',\
|
|
\ 'Accept-Language,User-Agent, X-Foo');\n# $this->assertEquals(['Accept-Language',\
|
|
\ 'User-Agent', 'X-Foo'], $response->getVary(), '->getVary() parses multiple header\
|
|
\ name values separated by commas');\n# \n# $vary = ['Accept-Language', 'User-Agent',\
|
|
\ 'X-foo'];\n# \n# $response = new Response();\n# $response->headers->set('Vary',\
|
|
\ $vary);\n# $this->assertEquals($vary, $response->getVary(), '->getVary() parses\
|
|
\ multiple header name values in arrays');\n# \n# $response = new Response();\n\
|
|
# $response->headers->set('Vary', 'Accept-Language, User-Agent, X-foo');\n# $this->assertEquals($vary,\
|
|
\ $response->getVary(), '->getVary() parses multiple header name values in arrays');\n\
|
|
# }\n# \n# public function testSetVary()\n# {\n# $response = new Response();\n\
|
|
# $response->setVary('Accept-Language');\n# $this->assertEquals(['Accept-Language'],\
|
|
\ $response->getVary());\n# \n# $response->setVary('Accept-Language, User-Agent');\n\
|
|
# $this->assertEquals(['Accept-Language', 'User-Agent'], $response->getVary(),\
|
|
\ '->setVary() replace the vary header by default');\n# \n# $response->setVary('X-Foo',\
|
|
\ false);\n# $this->assertEquals(['Accept-Language', 'User-Agent', 'X-Foo'], $response->getVary(),\
|
|
\ '->setVary() doesn\\'t wipe out earlier Vary headers if replace is set to false');\n\
|
|
# }\n# \n# public function testDefaultContentType()\n# {\n# $response = new Response('foo');\n\
|
|
# $response->prepare(new Request());\n# \n# $this->assertSame('text/html; charset=UTF-8',\
|
|
\ $response->headers->get('Content-Type'));\n# }\n# \n# public function testContentTypeCharset()\n\
|
|
# {\n# $response = new Response();\n# $response->headers->set('Content-Type',\
|
|
\ 'text/css');\n# \n# // force fixContentType() to be called\n# $response->prepare(new\
|
|
\ Request());\n# \n# $this->assertEquals('text/css; charset=UTF-8', $response->headers->get('Content-Type'));\n\
|
|
# }\n# \n# public function testContentTypeIsNull()\n# {\n# $response = new Response('foo');\n\
|
|
# $response->headers->set('Content-Type', null);\n# \n# $response->prepare(new\
|
|
\ Request());\n# \n# $this->expectNotToPerformAssertions();\n# }\n# \n# public\
|
|
\ function testPrepareDoesNothingIfContentTypeIsSet()\n# {\n# $response = new\
|
|
\ Response('foo');\n# $response->headers->set('Content-Type', 'text/plain');\n\
|
|
# \n# $response->prepare(new Request());\n# \n# $this->assertEquals('text/plain;\
|
|
\ charset=UTF-8', $response->headers->get('content-type'));\n# }\n# \n# public\
|
|
\ function testPrepareDoesNothingIfRequestFormatIsNotDefined()\n# {\n# $response\
|
|
\ = new Response('foo');\n# \n# $response->prepare(new Request());\n# \n# $this->assertEquals('text/html;\
|
|
\ charset=UTF-8', $response->headers->get('content-type'));\n# }\n# \n# /**\n\
|
|
# * Same URL cannot produce different Content-Type based on the value of the Accept\
|
|
\ header,\n# * unless explicitly stated in the response object."
|
|
- name: testPrepareSetContentType
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testPrepareRemovesContentForHeadRequests
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testPrepareRemovesContentForInformationalResponse
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testPrepareRemovesContentLength
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testPrepareSetsPragmaOnHttp10Only
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testPrepareSetsCookiesSecure
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testSetCache
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testSendContent
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testSetPublic
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testSetImmutable
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testIsImmutable
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testSetDate
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testSetDateWithImmutable
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testSetExpires
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testSetExpiresWithImmutable
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testSetLastModified
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testSetLastModifiedWithImmutable
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testIsInvalid
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testSetStatusCode
|
|
visibility: public
|
|
parameters:
|
|
- name: code
|
|
- name: text
|
|
- name: expectedText
|
|
comment: '# * @dataProvider getStatusCodeFixtures'
|
|
- name: getStatusCodeFixtures
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testIsInformational
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testIsRedirectRedirection
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testIsNotFound
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testIsEmpty
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testIsForbidden
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testIsOk
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testIsServerOrClientError
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testHasVary
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testSetEtag
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testSetContent
|
|
visibility: public
|
|
parameters:
|
|
- name: content
|
|
comment: '# * @dataProvider validContentProvider'
|
|
- name: testSettersAreChainable
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testNoDeprecationsAreTriggered
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: validContentProvider
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: createDateTimeOneHourAgo
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: createDateTimeOneHourLater
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: createDateTimeNow
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: createDateTimeImmutableNow
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: provideResponse
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: ianaCodesReasonPhrasesProvider
|
|
visibility: public
|
|
parameters: []
|
|
comment: "# * @see http://github.com/zendframework/zend-diactoros for the canonical\
|
|
\ source repository\n# *\n# * @author F\xE1bio Pacheco\n# * @copyright Copyright\
|
|
\ (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com)\n# * @license\
|
|
\ https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD\
|
|
\ License"
|
|
- name: testReasonPhraseDefaultsAgainstIana
|
|
visibility: public
|
|
parameters:
|
|
- name: code
|
|
- name: reasonPhrase
|
|
comment: '# * @dataProvider ianaCodesReasonPhrasesProvider'
|
|
- name: testSetContentSafe
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: __toString
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
traits:
|
|
- Symfony\Component\HttpFoundation\Cookie
|
|
- Symfony\Component\HttpFoundation\Request
|
|
- Symfony\Component\HttpFoundation\Response
|
|
interfaces: []
|