You are here

public function UserPasswordResetTest::languagePrefixTestProvider in Drupal 9

Data provider for testUserPasswordResetPreferredLanguage().

Return value

array

File

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

Class

UserPasswordResetTest
Ensure that password reset methods work as expected.

Namespace

Drupal\Tests\user\Functional

Code

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