transparent-email/tests/TransparentEmailFactoryTest.php

36 lines
1.2 KiB
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace bkrukowski\TransparentEmail\Tests;
use bkrukowski\TransparentEmail\Emails\Email;
use bkrukowski\TransparentEmail\Emails\EmailInterface;
use bkrukowski\TransparentEmail\TransparentEmailFactory;
2020-02-13 16:27:05 +03:00
use PHPUnit\Framework\TestCase;
2020-02-13 16:27:05 +03:00
class TransparentEmailFactoryTest extends TestCase
{
/**
* @dataProvider providerExpectedEmail
*
* @param EmailInterface $inputEmail
* @param string $expectedEmail
*/
public function testExpectedEmail(EmailInterface $inputEmail, string $expectedEmail)
{
2016-10-26 21:13:11 +03:00
$outputEmail = (new TransparentEmailFactory())->createDefault()->getPrimaryEmail($inputEmail);
$this->assertSame($expectedEmail, (string) $outputEmail);
}
public function providerExpectedEmail() : array
{
return [
[new Email('John.Doe+spam@gmail.com', true), 'johndoe@gmail.com'],
[new Email('Jane.Doe+spam@outlook.com', true), 'jane.doe@outlook.com'],
[new Email('John.Doe@tlen.pl', true), 'john.doe@o2.pl'],
[new Email('ALIAS@janedoe.33mail.com', true), 'janedoe@janedoe.33mail.com'],
[new Email('John.Doe-facebook@yahoo.com', true), 'john.doe@yahoo.com'],
];
}
}