Mercurial > hg > isophonics-drupal-site
comparison core/modules/user/tests/src/Kernel/UserValidationTest.php @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 129ea1e6d783 |
children |
comparison
equal
deleted
inserted
replaced
17:129ea1e6d783 | 18:af1871eacc83 |
---|---|
6 use Drupal\Core\Language\Language; | 6 use Drupal\Core\Language\Language; |
7 use Drupal\Core\Render\Element\Email; | 7 use Drupal\Core\Render\Element\Email; |
8 use Drupal\KernelTests\KernelTestBase; | 8 use Drupal\KernelTests\KernelTestBase; |
9 use Drupal\user\Entity\Role; | 9 use Drupal\user\Entity\Role; |
10 use Drupal\user\Entity\User; | 10 use Drupal\user\Entity\User; |
11 use Drupal\user\UserInterface; | |
11 | 12 |
12 /** | 13 /** |
13 * Verify that user validity checks behave as designed. | 14 * Verify that user validity checks behave as designed. |
14 * | 15 * |
15 * @group user | 16 * @group user |
61 'foo/' => ['Invalid username containing invalid chars', 'assertNotNull'], | 62 'foo/' => ['Invalid username containing invalid chars', 'assertNotNull'], |
62 // NULL. | 63 // NULL. |
63 'foo' . chr(0) . 'bar' => ['Invalid username containing chr(0)', 'assertNotNull'], | 64 'foo' . chr(0) . 'bar' => ['Invalid username containing chr(0)', 'assertNotNull'], |
64 // CR. | 65 // CR. |
65 'foo' . chr(13) . 'bar' => ['Invalid username containing chr(13)', 'assertNotNull'], | 66 'foo' . chr(13) . 'bar' => ['Invalid username containing chr(13)', 'assertNotNull'], |
66 str_repeat('x', USERNAME_MAX_LENGTH + 1) => ['Invalid excessively long username', 'assertNotNull'], | 67 str_repeat('x', UserInterface::USERNAME_MAX_LENGTH + 1) => ['Invalid excessively long username', 'assertNotNull'], |
67 ]; | 68 ]; |
68 foreach ($test_cases as $name => $test_case) { | 69 foreach ($test_cases as $name => $test_case) { |
69 list($description, $test) = $test_case; | 70 list($description, $test) = $test_case; |
70 $result = user_validate_name($name); | 71 $result = user_validate_name($name); |
71 $this->$test($result, $description . ' (' . $name . ')'); | 72 $this->$test($result, $description . ' (' . $name . ')'); |