function LanguageNegotiationUrlTest::providerTestDomain

Same name in other branches
  1. 9 core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php \Drupal\Tests\language\Unit\LanguageNegotiationUrlTest::providerTestDomain()
  2. 10 core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php \Drupal\Tests\language\Unit\LanguageNegotiationUrlTest::providerTestDomain()
  3. 11.x core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php \Drupal\Tests\language\Unit\LanguageNegotiationUrlTest::providerTestDomain()

Provides data for the domain test.

Return value

array An array of data for checking domain negotiation.

File

core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php, line 194

Class

LanguageNegotiationUrlTest
@coversDefaultClass \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl @group language

Namespace

Drupal\Tests\language\Unit

Code

public function providerTestDomain() {
    $domain_configuration[] = [
        'http_host' => 'example.de',
        'domains' => [
            'de' => 'http://example.de',
        ],
        'expected_langcode' => 'de',
    ];
    // No configuration.
    $domain_configuration[] = [
        'http_host' => 'example.de',
        'domains' => [],
        'expected_langcode' => FALSE,
    ];
    // HTTP host with a port.
    $domain_configuration[] = [
        'http_host' => 'example.de:8080',
        'domains' => [
            'de' => 'http://example.de',
        ],
        'expected_langcode' => 'de',
    ];
    // Domain configuration with https://.
    $domain_configuration[] = [
        'http_host' => 'example.de',
        'domains' => [
            'de' => 'https://example.de',
        ],
        'expected_langcode' => 'de',
    ];
    // Non-matching HTTP host.
    $domain_configuration[] = [
        'http_host' => 'example.com',
        'domains' => [
            'de' => 'http://example.com',
        ],
        'expected_langcode' => 'de',
    ];
    // Testing a non-existing language.
    $domain_configuration[] = [
        'http_host' => 'example.com',
        'domains' => [
            'it' => 'http://example.it',
        ],
        'expected_langcode' => FALSE,
    ];
    // Multiple domain configurations.
    $domain_configuration[] = [
        'http_host' => 'example.com',
        'domains' => [
            'de' => 'http://example.de',
            'en' => 'http://example.com',
        ],
        'expected_langcode' => 'en',
    ];
    return $domain_configuration;
}

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