Skip to content

Commit 6ad28dd

Browse files
longwaveRoSk0
authored andcommitted
Fix Drupal bootstrap.
1 parent 465045c commit 6ad28dd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/DrupalHelper.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
namespace SimpleSAML\Module\drupalauth;
44

55
use Drupal\Core\DrupalKernel;
6+
use Drupal\Core\Routing\RouteObjectInterface;
67
use Symfony\Component\HttpFoundation\Request;
8+
use Symfony\Component\Routing\Route;
79

810
class DrupalHelper
911
{
@@ -13,6 +15,8 @@ class DrupalHelper
1315
* Boot Drupal.
1416
*
1517
* @param string $drupalRoot Path to Drupal root.
18+
*
19+
* @see \Drupal\Core\Test\FunctionalTestSetupTrait::initKernel()
1620
*/
1721
public function bootDrupal(string $drupalRoot)
1822
{
@@ -21,8 +25,11 @@ public function bootDrupal(string $drupalRoot)
2125
$originalDir = getcwd();
2226
chdir($drupalRoot);
2327
$kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod', true, $drupalRoot);
28+
$kernel->invalidateContainer();
2429
$kernel->boot();
25-
$kernel->loadLegacyIncludes();
30+
$request->attributes->set(RouteObjectInterface::ROUTE_OBJECT, new Route('<none>'));
31+
$request->attributes->set(RouteObjectInterface::ROUTE_NAME, '<none>');
32+
$kernel->preHandle($request);
2633
chdir($originalDir);
2734
\restore_exception_handler();
2835
\restore_error_handler();

0 commit comments

Comments
 (0)