function EmailValidatorTest::testIsValid

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Component/Utility/EmailValidatorTest.php \Drupal\Tests\Component\Utility\EmailValidatorTest::testIsValid()
  2. 8.9.x core/tests/Drupal/Tests/Component/Utility/EmailValidatorTest.php \Drupal\Tests\Component\Utility\EmailValidatorTest::testIsValid()
  3. 10 core/tests/Drupal/Tests/Component/Utility/EmailValidatorTest.php \Drupal\Tests\Component\Utility\EmailValidatorTest::testIsValid()

@covers ::isValid

File

core/tests/Drupal/Tests/Component/Utility/EmailValidatorTest.php, line 22

Class

EmailValidatorTest
Tests the EmailValidator utility class.

Namespace

Drupal\Tests\Component\Utility

Code

public function testIsValid() : void {
    // Note that \Drupal\Component\Utility\EmailValidator wraps
    // \Egulias\EmailValidator\EmailValidator so we don't do anything more than
    // test that the wrapping works since the dependency has its own test
    // coverage.
    $validator = new EmailValidator();
    $this->assertTrue($validator->isValid('example@example.com'));
    $this->assertFalse($validator->isValid('example@example.com@'));
    $this->assertFalse($validator->isValid('example@example .com'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.