function EmailValidatorTest::testIsValid

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Utility/EmailValidatorTest.php \Drupal\Tests\Component\Utility\EmailValidatorTest::testIsValid()
  2. 10 core/tests/Drupal/Tests/Component/Utility/EmailValidatorTest.php \Drupal\Tests\Component\Utility\EmailValidatorTest::testIsValid()
  3. 11.x 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 20

Class

EmailValidatorTest
Tests the EmailValidator utility class.

Namespace

Drupal\Tests\Component\Utility

Code

public function testIsValid() {
    // 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@'));
}

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