diff --git a/core/modules/node/tests/src/Kernel/Migrate/d6/NodeTranslationRedirectTest.php b/core/modules/node/tests/src/Kernel/Migrate/d6/NodeTranslationRedirectTest.php index b4d2a99e37..8f65a219c4 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d6/NodeTranslationRedirectTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d6/NodeTranslationRedirectTest.php @@ -55,7 +55,7 @@ protected function setUp(): void { public function testNodeTranslationRedirect() { $kernel = $this->container->get('http_kernel'); $request = Request::create('/node/11'); - $request->getSession($this->getSessionFromRequest()); + $request->setSession($this->getSessionFromRequest()); $response = $kernel->handle($request); $this->assertSame(301, $response->getStatusCode()); $this->assertSame('/node/10', $response->getTargetUrl()); diff --git a/core/tests/Drupal/KernelTests/Core/Session/SessionManagerDestroyNoCliCheckTest.php b/core/tests/Drupal/KernelTests/Core/Session/SessionManagerDestroyNoCliCheckTest.php index 01fdd84ca9..fd4f203b5a 100644 --- a/core/tests/Drupal/KernelTests/Core/Session/SessionManagerDestroyNoCliCheckTest.php +++ b/core/tests/Drupal/KernelTests/Core/Session/SessionManagerDestroyNoCliCheckTest.php @@ -2,6 +2,7 @@ namespace Drupal\KernelTests\Core\Session; +use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\KernelTests\KernelTestBase; /** @@ -11,12 +12,24 @@ */ class SessionManagerDestroyNoCliCheckTest extends KernelTestBase { + /** + * {@inheritdoc} + */ + public function register(ContainerBuilder $container) { + // This test needs to operate on the production session_manager. Thus move + // it to another id before parent::register() installs the mock session + // manager. + $session_manager_prod = $container->getDefinition('session_manager'); + $container->setDefinition('session_manager.production', $session_manager_prod); + parent::register($container); + } + /** * Tests starting and destroying a session from the CLI. */ public function testCallSessionManagerStartAndDestroy() { - $this->assertFalse(\Drupal::service('session_manager')->start()); - $this->assertNull(\Drupal::service('session_manager')->destroy()); + $this->assertFalse(\Drupal::service('session_manager.production')->start()); + $this->assertNull(\Drupal::service('session_manager.production')->destroy()); } }