diff options
author | Lee Rowlands <lee.rowlands@previousnext.com.au> | 2023-12-28 08:03:14 +1000 |
---|---|---|
committer | Lee Rowlands <lee.rowlands@previousnext.com.au> | 2023-12-28 08:03:14 +1000 |
commit | fbee2baaab8fb8f8be29462e4798b51e1fe758d4 (patch) | |
tree | 976ab6bc1996f933d735884dfc83298074745fb4 /core/modules/language | |
parent | c980ece64ec31e8ae96a3c73d450472dff69b531 (diff) | |
download | drupal-fbee2baaab8fb8f8be29462e4798b51e1fe758d4.tar.gz drupal-fbee2baaab8fb8f8be29462e4798b51e1fe758d4.zip |
Issue #2484991 by znerol, voleger, andypost, dww, anmolgoyal74, markdorison, ankithashetty, larowlan, daffie, alexpott: Add the session to the request in KernelTestBase, BrowserTestBase, and drush
Diffstat (limited to 'core/modules/language')
3 files changed, 9 insertions, 0 deletions
diff --git a/core/modules/language/tests/src/Functional/LanguageNegotiationContentEntityTest.php b/core/modules/language/tests/src/Functional/LanguageNegotiationContentEntityTest.php index d13b923e3b72..d74a1def3940 100644 --- a/core/modules/language/tests/src/Functional/LanguageNegotiationContentEntityTest.php +++ b/core/modules/language/tests/src/Functional/LanguageNegotiationContentEntityTest.php @@ -10,6 +10,8 @@ use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl; use Drupal\Tests\BrowserTestBase; use Drupal\Core\Routing\RouteObjectInterface; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Session\Session; +use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Symfony\Component\Routing\Route; /** @@ -185,6 +187,7 @@ class LanguageNegotiationContentEntityTest extends BrowserTestBase { $request = Request::create($path); $request->attributes->set(RouteObjectInterface::ROUTE_NAME, $route_name); $request->attributes->set(RouteObjectInterface::ROUTE_OBJECT, new Route($path)); + $request->setSession(new Session(new MockArraySessionStorage())); $this->container->get('request_stack')->push($request); } diff --git a/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php b/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php index 7a635e114076..46f518b2194a 100644 --- a/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php +++ b/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php @@ -19,6 +19,8 @@ use Drupal\Core\Language\LanguageInterface; use Symfony\Component\HttpFoundation\Request; use Drupal\language\LanguageNegotiatorInterface; use Drupal\block\Entity\Block; +use Symfony\Component\HttpFoundation\Session\Session; +use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; /** * Tests the language UI for language switching. @@ -564,6 +566,7 @@ class LanguageUILanguageNegotiationTest extends BrowserTestBase { // Test HTTPS via current URL scheme. $request = Request::create('', 'GET', [], [], [], ['HTTPS' => 'on']); + $request->setSession(new Session(new MockArraySessionStorage())); $this->container->get('request_stack')->push($request); $italian_url = Url::fromRoute('system.admin', [], ['language' => $languages['it']])->toString(); $correct_link = 'https://' . $link; diff --git a/core/modules/language/tests/src/Kernel/EntityUrlLanguageTest.php b/core/modules/language/tests/src/Kernel/EntityUrlLanguageTest.php index 58ccffc612e7..44505aac764d 100644 --- a/core/modules/language/tests/src/Kernel/EntityUrlLanguageTest.php +++ b/core/modules/language/tests/src/Kernel/EntityUrlLanguageTest.php @@ -9,6 +9,8 @@ use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationContentEntity; use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl; use Drupal\Core\Routing\RouteObjectInterface; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Session\Session; +use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Symfony\Component\Routing\Route; /** @@ -132,6 +134,7 @@ class EntityUrlLanguageTest extends LanguageTestBase { $request = Request::create($path); $request->attributes->set(RouteObjectInterface::ROUTE_NAME, $route_name); $request->attributes->set(RouteObjectInterface::ROUTE_OBJECT, new Route($path)); + $request->setSession(new Session(new MockArraySessionStorage())); $this->container->get('request_stack')->push($request); } |