File
2 years ago
Fixtures
2 years ago
Session
2 years ago
schema
2 years ago
AcceptHeaderItemTest.php
2 years ago
AcceptHeaderTest.php
2 years ago
ApacheRequestTest.php
2 years ago
BinaryFileResponseTest.php
2 years ago
CookieTest.php
2 years ago
ExpressionRequestMatcherTest.php
2 years ago
FileBagTest.php
2 years ago
HeaderBagTest.php
2 years ago
IpUtilsTest.php
2 years ago
JsonResponseTest.php
2 years ago
ParameterBagTest.php
2 years ago
RedirectResponseTest.php
2 years ago
RequestMatcherTest.php
2 years ago
RequestStackTest.php
2 years ago
RequestTest.php
2 years ago
ResponseFunctionalTest.php
2 years ago
ResponseHeaderBagTest.php
2 years ago
ResponseTest.php
2 years ago
ResponseTestCase.php
2 years ago
ServerBagTest.php
2 years ago
StreamedResponseTest.php
2 years ago
ResponseTestCase.php
93 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of the Symfony package. |
| 5 | * |
| 6 | * (c) Fabien Potencier <fabien@symfony.com> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | * |
| 11 | * Modified by impress-org on 23-January-2024 using Strauss. |
| 12 | * @see https://github.com/BrianHenryIE/strauss |
| 13 | */ |
| 14 | |
| 15 | namespace Give\Vendors\Symfony\Component\HttpFoundation\Tests; |
| 16 | |
| 17 | use PHPUnit\Framework\TestCase; |
| 18 | use Give\Vendors\Symfony\Component\HttpFoundation\Request; |
| 19 | |
| 20 | abstract class ResponseTestCase extends TestCase |
| 21 | { |
| 22 | public function testNoCacheControlHeaderOnAttachmentUsingHTTPSAndMSIE() |
| 23 | { |
| 24 | // Check for HTTPS and IE 8 |
| 25 | $request = new Request(); |
| 26 | $request->server->set('HTTPS', true); |
| 27 | $request->server->set('HTTP_USER_AGENT', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)'); |
| 28 | |
| 29 | $response = $this->provideResponse(); |
| 30 | $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"'); |
| 31 | $response->prepare($request); |
| 32 | |
| 33 | $this->assertFalse($response->headers->has('Cache-Control')); |
| 34 | |
| 35 | // Check for IE 10 and HTTPS |
| 36 | $request->server->set('HTTP_USER_AGENT', 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)'); |
| 37 | |
| 38 | $response = $this->provideResponse(); |
| 39 | $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"'); |
| 40 | $response->prepare($request); |
| 41 | |
| 42 | $this->assertTrue($response->headers->has('Cache-Control')); |
| 43 | |
| 44 | // Check for IE 9 and HTTPS |
| 45 | $request->server->set('HTTP_USER_AGENT', 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 7.1; Trident/5.0)'); |
| 46 | |
| 47 | $response = $this->provideResponse(); |
| 48 | $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"'); |
| 49 | $response->prepare($request); |
| 50 | |
| 51 | $this->assertTrue($response->headers->has('Cache-Control')); |
| 52 | |
| 53 | // Check for IE 9 and HTTP |
| 54 | $request->server->set('HTTPS', false); |
| 55 | |
| 56 | $response = $this->provideResponse(); |
| 57 | $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"'); |
| 58 | $response->prepare($request); |
| 59 | |
| 60 | $this->assertTrue($response->headers->has('Cache-Control')); |
| 61 | |
| 62 | // Check for IE 8 and HTTP |
| 63 | $request->server->set('HTTP_USER_AGENT', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)'); |
| 64 | |
| 65 | $response = $this->provideResponse(); |
| 66 | $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"'); |
| 67 | $response->prepare($request); |
| 68 | |
| 69 | $this->assertTrue($response->headers->has('Cache-Control')); |
| 70 | |
| 71 | // Check for non-IE and HTTPS |
| 72 | $request->server->set('HTTPS', true); |
| 73 | $request->server->set('HTTP_USER_AGENT', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.60 Safari/537.17'); |
| 74 | |
| 75 | $response = $this->provideResponse(); |
| 76 | $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"'); |
| 77 | $response->prepare($request); |
| 78 | |
| 79 | $this->assertTrue($response->headers->has('Cache-Control')); |
| 80 | |
| 81 | // Check for non-IE and HTTP |
| 82 | $request->server->set('HTTPS', false); |
| 83 | |
| 84 | $response = $this->provideResponse(); |
| 85 | $response->headers->set('Content-Disposition', 'attachment; filename="fname.ext"'); |
| 86 | $response->prepare($request); |
| 87 | |
| 88 | $this->assertTrue($response->headers->has('Cache-Control')); |
| 89 | } |
| 90 | |
| 91 | abstract protected function provideResponse(); |
| 92 | } |
| 93 |