Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / symfony / http-foundation / Tests / ResponseFunctionalTest.php
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 = array(
26             1 => array('file', '/dev/null', 'w'),
27             2 => array('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         $result = file_get_contents(sprintf('http://localhost:8054/%s.php', $fixture));
49         $this->assertStringMatchesFormatFile(__DIR__.sprintf('/Fixtures/response-functional/%s.expected', $fixture), $result);
50     }
51
52     public function provideCookie()
53     {
54         foreach (glob(__DIR__.'/Fixtures/response-functional/*.php') as $file) {
55             yield array(pathinfo($file, PATHINFO_FILENAME));
56         }
57     }
58 }