File
4 years ago
Fixtures
4 years ago
Session
4 years ago
schema
4 years ago
AcceptHeaderItemTest.php
4 years ago
AcceptHeaderTest.php
4 years ago
ApacheRequestTest.php
4 years ago
BinaryFileResponseTest.php
4 years ago
CookieTest.php
4 years ago
ExpressionRequestMatcherTest.php
4 years ago
FileBagTest.php
4 years ago
HeaderBagTest.php
4 years ago
IpUtilsTest.php
4 years ago
JsonResponseTest.php
4 years ago
ParameterBagTest.php
4 years ago
RedirectResponseTest.php
4 years ago
RequestMatcherTest.php
4 years ago
RequestStackTest.php
4 years ago
RequestTest.php
4 years ago
ResponseFunctionalTest.php
4 years ago
ResponseHeaderBagTest.php
4 years ago
ResponseTest.php
4 years ago
ResponseTestCase.php
4 years ago
ServerBagTest.php
4 years ago
StreamedResponseTest.php
4 years ago
ResponseFunctionalTest.php
63 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 | |
| 12 | namespace Symfony\Component\HttpFoundation\Tests; |
| 13 | |
| 14 | use PHPUnit\Framework\TestCase; |
| 15 | |
| 16 | /** |
| 17 | * @requires PHP 7.0 |
| 18 | */ |
| 19 | class ResponseFunctionalTest extends TestCase |
| 20 | { |
| 21 | private static $server; |
| 22 | |
| 23 | public static function setUpBeforeClass() |
| 24 | { |
| 25 | $spec = [ |
| 26 | 1 => ['file', '/dev/null', 'w'], |
| 27 | 2 => ['file', '/dev/null', 'w'], |
| 28 | ]; |
| 29 | if (!self::$server = @proc_open('exec php -S localhost:8054', $spec, $pipes, __DIR__.'/Fixtures/response-functional')) { |
| 30 | self::markTestSkipped('PHP server unable to start.'); |
| 31 | } |
| 32 | sleep(1); |
| 33 | } |
| 34 | |
| 35 | public static function tearDownAfterClass() |
| 36 | { |
| 37 | if (self::$server) { |
| 38 | proc_terminate(self::$server); |
| 39 | proc_close(self::$server); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * @dataProvider provideCookie |
| 45 | */ |
| 46 | public function testCookie($fixture) |
| 47 | { |
| 48 | if (\PHP_VERSION_ID >= 80000 && 'cookie_max_age' === $fixture) { |
| 49 | $this->markTestSkipped('This fixture produces a fatal error on PHP 8.'); |
| 50 | } |
| 51 | |
| 52 | $result = file_get_contents(sprintf('http://localhost:8054/%s.php', $fixture)); |
| 53 | $this->assertStringMatchesFormatFile(__DIR__.sprintf('/Fixtures/response-functional/%s.expected', $fixture), $result); |
| 54 | } |
| 55 | |
| 56 | public function provideCookie() |
| 57 | { |
| 58 | foreach (glob(__DIR__.'/Fixtures/response-functional/*.php') as $file) { |
| 59 | yield [pathinfo($file, \PATHINFO_FILENAME)]; |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 |