Commit 6b231d8f authored by Niklas Fiekas's avatar Niklas Fiekas Committed by katbailey

Database bootstrap level before booting kernel.

Switching to the test database connection only happens when
_drupal_bootstrap_database() runs before executing a first query.

To avoid complicating the boostrap with more fine grained level booting, just
boot the DrupalKernel after DRUPAL_BOOTSTRAP_CODE. Getting rid of those levels
is for a seperate issue.

Additionally mirror the changes in the testing files
core/modules/system/tests/http.php and https.php.
parent 0e9c1150
......@@ -23,14 +23,8 @@ public function registerBundles() {
new CoreBundle(),
);
// Rather than bootstrapping to a higher phase prior to booting the Kernel, which
// would ensure these files are loaded already, we want to boot the Kernel as
// early as possible in the bootstrapping phase.
// TODO: Somehow remove the necessity of calling system_list() to find out which
// bundles exist.
require_once DRUPAL_ROOT . '/core/includes/cache.inc';
require_once DRUPAL_ROOT . '/core/includes/module.inc';
require_once DRUPAL_ROOT . '/core/includes/database.inc';
$modules = array_keys(system_list('module_enabled'));
foreach ($modules as $module) {
......
......@@ -5,6 +5,7 @@
* Fake an HTTP request, for use during testing.
*/
use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;
// Set a global variable to indicate a mock HTTP request.
......@@ -36,6 +37,7 @@
drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE);
$kernel = drupal_container()->get('httpkernel');
$kernel = new DrupalKernel('prod', FALSE);
$kernel->boot();
$response = $kernel->handle($request)->prepare($request)->send();
$kernel->terminate($request, $response);
......@@ -5,6 +5,7 @@
* Fake an https request, for use during testing.
*/
use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;
// Set a global variable to indicate a mock HTTPS request.
......@@ -35,6 +36,7 @@
drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE);
$kernel = drupal_container()->get('httpkernel');
$kernel = new DrupalKernel('prod', FALSE);
$kernel->boot();
$response = $kernel->handle($request)->prepare($request)->send();
$kernel->terminate($request, $response);
......@@ -30,9 +30,6 @@
// container at some point.
request($request);
$kernel = new DrupalKernel('prod', FALSE);
$kernel->boot();
// Bootstrap all of Drupal's subsystems, but do not initialize anything that
// depends on the fully resolved Drupal path, because path resolution happens
// during the REQUEST event of the kernel.
......@@ -40,6 +37,9 @@
// @see Drupal\Core\EventSubscriber\LegacyRequestSubscriber;
drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE);
$kernel = new DrupalKernel('prod', FALSE);
$kernel->boot();
$response = $kernel->handle($request)->prepare($request)->send();
$kernel->terminate($request, $response);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment