You are here

public function SMTPMailSystemTest::getComponentsProvider in SMTP Authentication Support 8

Provides scenarios for getComponents().

File

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

Class

SMTPMailSystemTest
Validate requirements for SMTPMailSystem.

Namespace

Drupal\Tests\smtp\Unit\Plugin\Mail

Code

public function getComponentsProvider() {
  return [
    [
      // Input.
      'name@example.com',
      // Expected.
      [
        'name' => '',
        'email' => 'name@example.com',
      ],
    ],
    [
      ' name@example.com',
      [
        'name' => '',
        'input' => 'name@example.com',
        'email' => 'name@example.com',
      ],
    ],
    [
      'name@example.com ',
      [
        'name' => '',
        'input' => 'name@example.com',
        'email' => 'name@example.com',
      ],
    ],
    [
      'some name <address@example.com>',
      [
        'name' => 'some name',
        'email' => 'address@example.com',
      ],
    ],
    [
      '"some name" <address@example.com>',
      [
        'name' => 'some name',
        'email' => 'address@example.com',
      ],
    ],
    [
      '<address@example.com>',
      [
        'name' => '',
        'email' => 'address@example.com',
      ],
    ],
  ];
}