diff --git a/core/modules/user/src/Tests/UserValidationTest.php b/core/modules/user/src/Tests/UserValidationTest.php index 101bd63..2dc2e02 100644 --- a/core/modules/user/src/Tests/UserValidationTest.php +++ b/core/modules/user/src/Tests/UserValidationTest.php @@ -70,6 +70,7 @@ function testValidation() { $user = entity_create('user', array('name' => 'test')); $violations = $user->validate(); $this->assertEqual(count($violations), 0, 'No violations when validating a default user.'); + // Only test one example invalid name here, the rest is already covered in // the testUsernames() method in this class. $name = $this->randomMachineName(61); @@ -78,6 +79,7 @@ function testValidation() { $this->assertEqual(count($violations), 1, 'Violation found when name is too long.'); $this->assertEqual($violations[0]->getPropertyPath(), 'name'); $this->assertEqual($violations[0]->getMessage(), t('The username %name is too long: it must be %max characters or less.', array('%name' => $name, '%max' => 60))); + // Create a second test user to provoke a name collision. $user2 = entity_create('user', array( 'name' => 'existing', @@ -112,7 +114,7 @@ function testValidation() { $this->assertEqual($violations[1]->getPropertyPath(), 'mail.0.value'); $this->assertEqual($violations[1]->getMessage(), t('This value is not a valid email address.')); - // Provoke a email collision with an existing user. + // Provoke an email collision with an existing user. $user->set('mail', 'existing@example.com'); $violations = $user->validate(); $this->assertEqual(count($violations), 1, 'Violation found when email already exists.');