You are here

public function LanguageNegotiationUrlTest::providerTestDomain in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 199
Contains \Drupal\Tests\language\Unit\LanguageNegotiationUrlTest.

Class

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

Namespace

Drupal\Tests\language\Unit

Code

public function providerTestDomain() {
  $domain_configuration[] = array(
    'http_host' => 'example.de',
    'domains' => array(
      'de' => 'http://example.de',
    ),
    'expected_langcode' => 'de',
  );

  // No configuration.
  $domain_configuration[] = array(
    'http_host' => 'example.de',
    'domains' => array(),
    'expected_langcode' => FALSE,
  );

  // HTTP host with a port.
  $domain_configuration[] = array(
    'http_host' => 'example.de:8080',
    'domains' => array(
      'de' => 'http://example.de',
    ),
    'expected_langcode' => 'de',
  );

  // Domain configuration with https://.
  $domain_configuration[] = array(
    'http_host' => 'example.de',
    'domains' => array(
      'de' => 'https://example.de',
    ),
    'expected_langcode' => 'de',
  );

  // Non-matching HTTP host.
  $domain_configuration[] = array(
    'http_host' => 'example.com',
    'domains' => array(
      'de' => 'http://example.com',
    ),
    'expected_langcode' => 'de',
  );

  // Testing a non-existing language.
  $domain_configuration[] = array(
    'http_host' => 'example.com',
    'domains' => array(
      'it' => 'http://example.it',
    ),
    'expected_langcode' => FALSE,
  );

  // Multiple domain configurations.
  $domain_configuration[] = array(
    'http_host' => 'example.com',
    'domains' => array(
      'de' => 'http://example.de',
      'en' => 'http://example.com',
    ),
    'expected_langcode' => 'en',
  );
  return $domain_configuration;
}