You are here

public function SMTPMailSystemTest::mailValidatorProvider in SMTP Authentication Support 8

Provides scenarios for testMailValidator().

File

tests/src/Unit/Plugin/Mail/SMTPMailSystemTest.php, line 184

Class

SMTPMailSystemTest
Validate requirements for SMTPMailSystem.

Namespace

Drupal\Tests\smtp\Unit\Plugin\Mail

Code

public function mailValidatorProvider() {
  $emailValidatorPhpMailerDefault = new EmailValidatorPhpMailerDefault();
  $emailValidatorDrupal = new EmailValidator();
  return [
    'Without umlauts, PHPMailer default validator, no exception' => [
      'test@drupal.org',
      'PhpUnit Localhost <phpunit@localhost.com>',
      $emailValidatorPhpMailerDefault,
      NULL,
    ],
    'With umlauts in local part, PHPMailer default validator, exception' => [
      'testmüller@drupal.org',
      'PhpUnit Localhost <phpunit@localhost.com>',
      $emailValidatorPhpMailerDefault,
      PHPMailerException::class,
    ],
    'With umlauts in domain part, PHPMailer default validator, exception' => [
      'test@müllertest.de',
      'PhpUnit Localhost <phpunit@localhost.com>',
      $emailValidatorPhpMailerDefault,
      PHPMailerException::class,
    ],
    'Without top-level domain in domain part, PHPMailer default validator, exception' => [
      'test@drupal',
      'PhpUnit Localhost <phpunit@localhost.com>',
      $emailValidatorPhpMailerDefault,
      PHPMailerException::class,
    ],
    'Without umlauts, Drupal mail validator, no exception' => [
      'test@drupal.org',
      'PhpUnit Localhost <phpunit@localhost.com>',
      $emailValidatorDrupal,
      NULL,
    ],
    'With umlauts in local part, Drupal mail validator, no exception' => [
      'testmüller@drupal.org',
      'PhpUnit Localhost <phpunit@localhost.com>',
      $emailValidatorDrupal,
      NULL,
    ],
    'With umlauts in domain part, Drupal mail validator, no exception' => [
      'test@müllertest.de',
      'PhpUnit Localhost <phpunit@localhost.com>',
      $emailValidatorDrupal,
      NULL,
    ],
    'Without top-level domain in domain part, Drupal mail validator, no exception' => [
      'test@drupal',
      'PhpUnit Localhost <phpunit@localhost.com>',
      $emailValidatorDrupal,
      NULL,
    ],
  ];
}