function SessionManagerTest::testDeprecatedMiddlewaresArgument
Same name and namespace in other branches
- main core/tests/Drupal/Tests/Core/Session/SessionManagerTest.php \Drupal\Tests\Core\Session\SessionManagerTest::testDeprecatedMiddlewaresArgument()
Tests that session manager is constructed with deprecated argument list.
Attributes
#[IgnoreDeprecations]
File
-
core/
tests/ Drupal/ Tests/ Core/ Session/ SessionManagerTest.php, line 33
Class
Namespace
Drupal\Tests\Core\SessionCode
public function testDeprecatedMiddlewaresArgument() : void {
$connection = $this->createStub(Connection::class);
$handler = new NullSessionHandler();
$sessionRepository = $this->createStub(UserSessionRepositoryInterface::class);
$container = new ContainerBuilder();
$container->set(UserSessionRepositoryInterface::class, $sessionRepository);
\Drupal::setContainer($container);
$this->expectUserDeprecationMessage('Calling Drupal\\Core\\Session\\SessionManager::__construct() with a database $connection as the second argument is deprecated in drupal:11.4.0 and it will throw an error in drupal:12.0.0. See https://www.drupal.org/node/3570851');
$sessionManager = new SessionManager(new RequestStack(), $connection, new MetadataBag(new Settings([])), new SessionConfiguration(), new Time(), $handler);
$abstractProxy = $sessionManager->getSaveHandler();
assert($abstractProxy instanceof SessionHandlerProxy);
$this->assertSame($handler, $abstractProxy->getHandler());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.