public function EmailFieldValidationRuleTest::testEmailRule in Field Validation 8
Test EmailFieldValidationRule.
File
- tests/
src/ Kernel/ Plugin/ FieldValidationRule/ EmailFieldValidationRuleTest.php, line 71
Class
- EmailFieldValidationRuleTest
- Tests EmailFieldValidationRule.
Namespace
Drupal\Tests\field_validation\Kernel\Plugin\FieldValidationRuleCode
public function testEmailRule() {
// Tests invalid input.
$this
->assertConstraintFail($this->entity, self::FIELD_NAME, 'invalid.com', $this->ruleSet);
// Tests valid input.
$this
->assertConstraintPass($this->entity, self::FIELD_NAME, 'valid@valid.com');
// Tests empty and malformed.
$this
->emptyAndMalformed(self::FIELD_NAME, $this->entity, $this->ruleSet);
}