TestKernel.php 808 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
<?php

/**
 * @file
 * Contains \Drupal\Core\Test\TestKernel.
 */

namespace Drupal\Core\Test;

use Drupal\Core\DrupalKernel;
11
use Symfony\Component\HttpFoundation\Request;
12
13

/**
14
 * Kernel to mock requests to test simpletest.
15
16
17
 */
class TestKernel extends DrupalKernel {

18
19
20
  /**
   * {@inheritdoc}
   */
21
  public static function createFromRequest(Request $request, $class_loader, $environment, $allow_dumping = TRUE) {
22
23
24
25
26
27
28
29
30
31
    // Include our bootstrap file.
    require_once __DIR__ . '/../../../../includes/bootstrap.inc';

    // Exit if we should be in a test environment but aren't.
    if (!drupal_valid_test_ua()) {
      header($request->server->get('SERVER_PROTOCOL') . ' 403 Forbidden');
      exit;
    }

    return parent::createFromRequest($request, $class_loader, $environment, $allow_dumping);
32
33
34
  }

}