assertTrue($validator->isValid('example@example.com')); $this->assertFalse($validator->isValid('example@example.com@')); } /** * @covers ::isValid */ 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())); } }