comparison core/modules/system/tests/https.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 /**
4 * @file
5 * Fake an HTTPS request, for use during testing.
6 *
7 * @todo Fix this to use a new request rather than modifying server variables,
8 * see http.php.
9 */
10
11 use Drupal\Core\Test\TestKernel;
12 use Symfony\Component\HttpFoundation\Request;
13
14 chdir('../../../..');
15
16 $autoloader = require_once 'autoload.php';
17
18 // Change to HTTPS.
19 $_SERVER['HTTPS'] = 'on';
20 foreach ($_SERVER as &$value) {
21 $value = str_replace('core/modules/system/tests/https.php', 'index.php', $value);
22 $value = str_replace('http://', 'https://', $value);
23 }
24
25 $kernel = new TestKernel('testing', $autoloader, TRUE);
26
27 $request = Request::createFromGlobals();
28 $response = $kernel->handle($request);
29 $response->send();
30
31 $kernel->terminate($request, $response);