You are here

public function LanguageNegotiationUrlTest::providerTestPathPrefix 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::providerTestPathPrefix()

Provides data for the path prefix test.

Return value

array An array of data for checking path prefix negotiation.

File

core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php, line 114
Contains \Drupal\Tests\language\Unit\LanguageNegotiationUrlTest.

Class

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

Namespace

Drupal\Tests\language\Unit

Code

public function providerTestPathPrefix() {
  $path_prefix_configuration[] = [
    'prefix' => 'de',
    'prefixes' => [
      'de' => 'de',
      'en-uk' => 'en',
    ],
    'expected_langcode' => 'de',
  ];
  $path_prefix_configuration[] = [
    'prefix' => 'en-uk',
    'prefixes' => [
      'de' => 'de',
      'en' => 'en-uk',
    ],
    'expected_langcode' => 'en',
  ];

  // No configuration.
  $path_prefix_configuration[] = [
    'prefix' => 'de',
    'prefixes' => array(),
    'expected_langcode' => FALSE,
  ];

  // Non-matching prefix.
  $path_prefix_configuration[] = [
    'prefix' => 'de',
    'prefixes' => [
      'en-uk' => 'en',
    ],
    'expected_langcode' => FALSE,
  ];

  // Non-existing language.
  $path_prefix_configuration[] = [
    'prefix' => 'it',
    'prefixes' => [
      'it' => 'it',
      'en-uk' => 'en',
    ],
    'expected_langcode' => FALSE,
  ];
  return $path_prefix_configuration;
}