function SessionConfigurationTest::testConstructorDefaultSettings

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php \Drupal\Tests\Core\Session\SessionConfigurationTest::testConstructorDefaultSettings()
  2. 10 core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php \Drupal\Tests\Core\Session\SessionConfigurationTest::testConstructorDefaultSettings()

Tests constructor's default settings.

@covers ::__construct

@dataProvider providerTestConstructorDefaultSettings

File

core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php, line 269

Class

SessionConfigurationTest
@coversDefaultClass \Drupal\Core\Session\SessionConfiguration @group Session

Namespace

Drupal\Tests\Core\Session

Code

public function testConstructorDefaultSettings(array $options, int $expected_sid_length, int $expected_sid_bits_per_character, string $expected_name_suffix) : void {
    $config = $this->createSessionConfiguration($options);
    $options = $config->getOptions(Request::createFromGlobals());
    if (\PHP_VERSION_ID >= 80400) {
        $this->assertArrayNotHasKey('sid_length', $options);
        $this->assertArrayNotHasKey('sid_bits_per_character', $options);
    }
    else {
        $this->assertSame($expected_sid_length, $options['sid_length']);
        $this->assertSame($expected_sid_bits_per_character, $options['sid_bits_per_character']);
    }
    $this->assertSame($expected_name_suffix, $options['name_suffix']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.