Commit 3f397e20 authored by catch's avatar catch
Browse files

Issue #3459240 by jurgenhaas, b_sharpe, longwave, quietone: Deprecation...

Issue #3459240 by jurgenhaas, b_sharpe, longwave, quietone: Deprecation message for user_validate_name points to an invalid replacement

(cherry picked from commit 717b02a8)
parent 38418798
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ public function testUsernames(): void {
      'foo' . chr(13) . 'bar'  => ['Invalid username containing chr(13)', 'assertNotNull'],
      str_repeat('x', UserInterface::USERNAME_MAX_LENGTH + 1) => ['Invalid excessively long username', 'assertNotNull'],
    ];
    $this->expectDeprecation('user_validate_name() is deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. Use \Drupal\user\UserValidator::validateName() instead. See https://www.drupal.org/node/3431205');
    $this->expectDeprecation('user_validate_name() is deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. Use \Drupal\user\UserNameValidator::validateName() instead. See https://www.drupal.org/node/3431205');
    // cSpell:enable
    foreach ($test_cases as $name => $test_case) {
      [$description, $test] = $test_case;
+2 −2
Original line number Diff line number Diff line
@@ -207,12 +207,12 @@ function user_load_by_name($name) {
 *   is valid.
 *
 * @deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. Use
 *   \Drupal\user\UserValidator::validateName() instead.
 *   \Drupal\user\UserNameValidator::validateName() instead.
 *
 * @see https://www.drupal.org/node/3431205
 */
function user_validate_name($name) {
  @trigger_error(__METHOD__ . '() is deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. Use \Drupal\user\UserValidator::validateName() instead. See https://www.drupal.org/node/3431205', E_USER_DEPRECATED);
  @trigger_error(__METHOD__ . '() is deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. Use \Drupal\user\UserNameValidator::validateName() instead. See https://www.drupal.org/node/3431205', E_USER_DEPRECATED);
  $violations = \Drupal::service('user.name_validator')->validateName($name);
  if (count($violations) > 0) {
    return $violations[0]->getMessage();