array_unshift($modules,
$second);
} } // Bootstrap the kernel. Do not use createFromRequest() to retain Settings.
$kernel =
new DrupalKernel('testing',
$this->classLoader, FALSE
);
$kernel->
setSitePath($this->siteDirectory
);
// Boot a new one-time container from scratch. Set the module list upfront
// to avoid a subsequent rebuild or setting the kernel into the
// pre-installer mode.
$extensions =
$modules ?
$this->
getExtensionsForModules($modules) :
[];
$kernel->
updateModules($extensions,
$extensions);
// DrupalKernel::boot() is not sufficient as it does not invoke preHandle(),
// which is required to initialize legacy global variables.
$request = Request::
create('/'
);
$kernel->
boot();
$request->attributes->
set(RouteObjectInterface::ROUTE_OBJECT,
new Route('<none>'
));
$request->attributes->
set(RouteObjectInterface::ROUTE_NAME, '<none>'
);
$kernel->
preHandle($request);
$this->container =
$kernel->
getContainer();