function UserPasswordResetTest::languagePrefixTestProvider

Same name in other branches
  1. 9 core/modules/user/tests/src/Functional/UserPasswordResetTest.php \Drupal\Tests\user\Functional\UserPasswordResetTest::languagePrefixTestProvider()
  2. 11.x core/modules/user/tests/src/Functional/UserPasswordResetTest.php \Drupal\Tests\user\Functional\UserPasswordResetTest::languagePrefixTestProvider()

Provides scenarios for testUserPasswordResetPreferredLanguage().

Return value

array

1 call to UserPasswordResetTest::languagePrefixTestProvider()
UserPasswordResetTest::testUserPasswordResetPreferredLanguage in core/modules/user/tests/src/Functional/UserPasswordResetTest.php
Tests password reset functionality when user has set preferred language.

File

core/modules/user/tests/src/Functional/UserPasswordResetTest.php, line 284

Class

UserPasswordResetTest
Ensure that password reset methods work as expected.

Namespace

Drupal\Tests\user\Functional

Code

protected function languagePrefixTestProvider() {
    return [
        'Test language prefix set as \'\', visiting default with preferred language as en' => [
            'setPreferredLangcode' => 'en',
            'activeLangcode' => 'en',
            'prefix' => '',
            'visitingUrl' => 'user/password',
            'expectedResetUrl' => 'user/reset',
            'unexpectedResetUrl' => 'en/user/reset',
        ],
        'Test language prefix set as fr, visiting zh with preferred language as fr' => [
            'setPreferredLangcode' => 'fr',
            'activeLangcode' => 'fr',
            'prefix' => 'fr',
            'visitingUrl' => 'zh/user/password',
            'expectedResetUrl' => 'fr/user/reset',
            'unexpectedResetUrl' => 'zh/user/reset',
        ],
        'Test language prefix set as zh, visiting zh with preferred language as \'\'' => [
            'setPreferredLangcode' => '',
            'activeLangcode' => 'zh-hant',
            'prefix' => 'zh',
            'visitingUrl' => 'zh/user/password',
            'expectedResetUrl' => 'user/reset',
            'unexpectedResetUrl' => 'zh/user/reset',
        ],
    ];
}

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