TestKernel.php 635 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace Drupal\Core\Test;
  3. use Drupal\Core\DrupalKernel;
  4. /**
  5. * Kernel to mock requests to test simpletest.
  6. */
  7. class TestKernel extends DrupalKernel {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. public function __construct($environment, $class_loader, $allow_dumping = TRUE) {
  12. // Include our bootstrap file.
  13. require_once __DIR__ . '/../../../../includes/bootstrap.inc';
  14. // Exit if we should be in a test environment but aren't.
  15. if (!drupal_valid_test_ua()) {
  16. header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
  17. exit;
  18. }
  19. parent::__construct($environment, $class_loader, $allow_dumping);
  20. }
  21. }