function SessionConfigurationTest::providerTestEnforcedSessionName

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php \Drupal\Tests\Core\Session\SessionConfigurationTest::providerTestEnforcedSessionName()
  2. 10 core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php \Drupal\Tests\Core\Session\SessionConfigurationTest::providerTestEnforcedSessionName()
  3. 11.x core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php \Drupal\Tests\Core\Session\SessionConfigurationTest::providerTestEnforcedSessionName()

Data provider for the cookie name test.

@returns array Test data

File

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

Class

SessionConfigurationTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Session%21SessionConfiguration.php/class/SessionConfiguration/9" title="Defines the default session configuration generator." class="local">\Drupal\Core\Session\SessionConfiguration</a> @group Session

Namespace

Drupal\Tests\Core\Session

Code

public function providerTestEnforcedSessionName() {
    $data = [
        [
            'http://example.com/path/index.php',
            'SESS',
            '.example.com',
        ],
        [
            'http://www.example.com/path/index.php',
            'SESS',
            '.example.com',
        ],
        [
            'http://subdomain.example.com/path/index.php',
            'SESS',
            '.example.com',
        ],
        [
            'http://example.com:8080/path/index.php',
            'SESS',
            '.example.com',
        ],
        [
            'https://example.com/path/index.php',
            'SSESS',
            '.example.com',
        ],
        [
            'http://example.com/path/core/install.php',
            'SESS',
            '.example.com',
        ],
        [
            'http://localhost/path/index.php',
            'SESS',
            '.example.com',
        ],
        [
            'http://127.0.0.1/path/index.php',
            'SESS',
            '.example.com',
        ],
        [
            'http://127.0.0.1:8888/path/index.php',
            'SESS',
            '.example.com',
        ],
        [
            'https://127.0.0.1/path/index.php',
            'SSESS',
            '.example.com',
        ],
        [
            'https://127.0.0.1:8443/path/index.php',
            'SSESS',
            '.example.com',
        ],
        [
            'http://1.1.1.1/path/index.php',
            'SESS',
            '.example.com',
        ],
        [
            'https://1.1.1.1/path/index.php',
            'SSESS',
            '.example.com',
        ],
        [
            'http://[::1]/path/index.php',
            'SESS',
            '.example.com',
        ],
        [
            'http://[::1]:8888/path/index.php',
            'SESS',
            '.example.com',
        ],
        [
            'https://[::1]/path/index.php',
            'SSESS',
            '.example.com',
        ],
        [
            'https://[::1]:8443/path/index.php',
            'SSESS',
            '.example.com',
        ],
    ];
    return array_map(function ($record) {
        return [
            $record[0],
            $record[1] . substr(hash('sha256', $record[2]), 0, 32),
        ];
    }, $data);
}

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