commit 683014c212bc4ba2f4a8a8b668bd26406e84f3de Author: Klaus Purer Date: Fri Jul 12 19:51:16 2013 +0200 Fixed email validation test. diff --git a/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php b/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php index 599a3c3..70f6b4c 100644 --- a/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php +++ b/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php @@ -64,7 +64,6 @@ public function setValue($values, $notify = TRUE) { $value = $values[$name]; } $property->setValue($value, FALSE); - unset($this->values[$name]); } // Notify the parent of any changes. if ($notify && isset($this->parent)) { diff --git a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php index b990c58..ff56396 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentStorageController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentStorageController.php @@ -165,8 +165,7 @@ public function baseFieldDefinitions() { $properties['mail'] = array( 'label' => t('e-mail'), 'description' => t("The comment author's e-mail address."), - // @todo Convert this to email_field when that data type actually works. - 'type' => 'string_field', + 'type' => 'email_field', ); $properties['homepage'] = array( 'label' => t('Homepage'), diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentValidationTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentValidationTest.php index 9efdfd1..0b7e4f1 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentValidationTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentValidationTest.php @@ -75,12 +75,12 @@ public function testValidation() { // Make the name valid. $comment->set('name', $this->randomString()); - // @todo Enable this test once the conversion to email_field is done and - // works. - /*$comment->set('mail', 'invalid'); + $comment->set('mail', 'invalid'); $violations = $comment->validate(); $this->assertEqual(count($violations), 1, 'Violation found when email is invalid'); - $this->assertEqual($violations[0]->getPropertyPath(), 'mail.0.value');*/ + $this->assertEqual($violations[0]->getPropertyPath(), 'mail.0.value'); + $this->assertEqual($violations[0]->getMessage(), t('This value is not a valid email address.')); + $comment->set('mail', NULL); $comment->set('homepage', 'http://example.com/' . $this->randomName(237)); $this->assertLengthViolation($comment, 'homepage', 255);