https.php 741 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * @file
  4. * Fake an HTTPS request, for use during testing.
  5. *
  6. * @todo Fix this to use a new request rather than modifying server variables,
  7. * see http.php.
  8. */
  9. use Drupal\Core\Test\TestKernel;
  10. use Symfony\Component\HttpFoundation\Request;
  11. chdir('../../../..');
  12. $autoloader = require_once 'autoload.php';
  13. // Change to HTTPS.
  14. $_SERVER['HTTPS'] = 'on';
  15. foreach ($_SERVER as &$value) {
  16. $value = str_replace('core/modules/system/tests/https.php', 'index.php', $value);
  17. $value = str_replace('http://', 'https://', $value);
  18. }
  19. $kernel = new TestKernel('testing', $autoloader, TRUE);
  20. $request = Request::createFromGlobals();
  21. $response = $kernel->handle($request);
  22. $response->send();
  23. $kernel->terminate($request, $response);