function LanguageNegotiationUrlTest::providerTestPathPrefix

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

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' => [],
        '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.