You are here

public function EmailValidatorTest::testIsValidException in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Component/Utility/EmailValidatorTest.php \Drupal\Tests\Component\Utility\EmailValidatorTest::testIsValidException()

@covers ::isValid

File

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

Class

EmailValidatorTest
Tests the EmailValidator utility class.

Namespace

Drupal\Tests\Component\Utility

Code

public function testIsValidException() {
  $validator = new EmailValidator();
  $this
    ->expectException(\BadMethodCallException::class);
  $this
    ->expectExceptionMessage('Calling \\Drupal\\Component\\Utility\\EmailValidator::isValid() with the second argument is not supported. See https://www.drupal.org/node/2997196');
  $validator
    ->isValid('example@example.com', new RFCValidation());
}