diff --git a/tests/Kernel/AbstractKernelTestBase.php b/tests/Kernel/AbstractKernelTestBase.php index 853a5d249..07bc3b6ad 100644 --- a/tests/Kernel/AbstractKernelTestBase.php +++ b/tests/Kernel/AbstractKernelTestBase.php @@ -45,6 +45,15 @@ protected function setUp() { $this->container->get('theme_installer')->install(['oe_theme']); $this->container->get('theme_handler')->setDefault('oe_theme'); $this->container->set('theme.registry', NULL); + + // Call the install hook of the User module which creates the Anonymous user + // and User 1. This is needed because the Anonymous user is loaded to + // provide the current User context which is needed in places like route + // enhancers. + // @see CurrentUserContext::getRuntimeContexts(). + // @see EntityConverter::convert(). + module_load_include('install', 'user'); + user_install(); } /** diff --git a/tests/Kernel/BreadcrumbTest.php b/tests/Kernel/BreadcrumbTest.php index f34afbc91..d94bb0859 100644 --- a/tests/Kernel/BreadcrumbTest.php +++ b/tests/Kernel/BreadcrumbTest.php @@ -47,6 +47,15 @@ protected function setUp() { $this->container->get('theme_installer')->install(['oe_theme']); $this->container->get('theme_handler')->setDefault('oe_theme'); $this->container->set('theme.registry', NULL); + + // Call the install hook of the User module which creates the Anonymous user + // and User 1. This is needed because the Anonymous user is loaded to + // provide the current User context which is needed in places like route + // enhancers. + // @see CurrentUserContext::getRuntimeContexts(). + // @see EntityConverter::convert(). + module_load_include('install', 'user'); + user_install(); } /** diff --git a/tests/Kernel/MultilingualAbstractKernelTestBase.php b/tests/Kernel/MultilingualAbstractKernelTestBase.php index 25c004212..e5be881db 100644 --- a/tests/Kernel/MultilingualAbstractKernelTestBase.php +++ b/tests/Kernel/MultilingualAbstractKernelTestBase.php @@ -65,6 +65,15 @@ protected function setUp() { // Rebuild the container in order to make sure tests pass. // @todo: fix test setup so that we can get rid of this line. $this->container->get('kernel')->rebuildContainer(); + + // Call the install hook of the User module which creates the Anonymous user + // and User 1. This is needed because the Anonymous user is loaded to + // provide the current User context which is needed in places like route + // enhancers. + // @see CurrentUserContext::getRuntimeContexts(). + // @see EntityConverter::convert(). + module_load_include('install', 'user'); + user_install(); } }