function LanguageNegotiationUrlTest::providerTestPathPrefix

Same name and namespace in other branches
  1. 9 core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php \Drupal\Tests\language\Unit\LanguageNegotiationUrlTest::providerTestPathPrefix()
  2. 8.9.x core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php \Drupal\Tests\language\Unit\LanguageNegotiationUrlTest::providerTestPathPrefix()
  3. 11.x 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 116

Class

LanguageNegotiationUrlTest
@coversDefaultClass \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl[[api-linebreak]] @group language

Namespace

Drupal\Tests\language\Unit

Code

public static 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' => [],
    '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;
}

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