Mercurial > hg > isophonics-drupal-site
diff core/modules/system/tests/http.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/modules/system/tests/http.php Wed Nov 29 16:09:58 2017 +0000 @@ -0,0 +1,29 @@ +<?php + +/** + * @file + * Fake an HTTP request, for use during testing. + */ + +use Drupal\Core\Test\TestKernel; +use Symfony\Component\HttpFoundation\Request; + +chdir('../../../..'); + +$autoloader = require_once 'autoload.php'; + +// Change to HTTP. +$_SERVER['HTTPS'] = NULL; +ini_set('session.cookie_secure', FALSE); +foreach ($_SERVER as &$value) { + $value = str_replace('core/modules/system/tests/http.php', 'index.php', $value); + $value = str_replace('https://', 'http://', $value); +} + +$kernel = new TestKernel('testing', $autoloader, TRUE); + +$request = Request::createFromGlobals(); +$response = $kernel->handle($request); +$response->send(); + +$kernel->terminate($request, $response);