public function LanguageNegotiationUrlTest::providerTestPathPrefix in Drupal 9
Same name and namespace in other branches
- 8 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 109
Class
- LanguageNegotiationUrlTest
- @coversDefaultClass \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl @group language
Namespace
Drupal\Tests\language\UnitCode
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' => [],
'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;
}