http.php 678 B

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