Test coverage

This commit is contained in:
bkrukowski 2016-09-24 12:42:00 +02:00
parent f7e1b62e81
commit 4614dcd7aa

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace bkrukowski\TransparentEmail\Tests; namespace bkrukowski\TransparentEmail\Tests;
use bkrukowski\TransparentEmail\Emails\Email; use bkrukowski\TransparentEmail\Emails\Email;
use bkrukowski\TransparentEmail\Emails\EmailInterface;
use bkrukowski\TransparentEmail\ServiceCollector; use bkrukowski\TransparentEmail\ServiceCollector;
use bkrukowski\TransparentEmail\ServiceCollectorInterface; use bkrukowski\TransparentEmail\ServiceCollectorInterface;
use bkrukowski\TransparentEmail\Services\TlenPl; use bkrukowski\TransparentEmail\Services\TlenPl;
@ -49,6 +50,28 @@ class TransparentEmailTest extends \PHPUnit_Framework_TestCase
]; ];
} }
/**
* @dataProvider providerDefault
*
* @param EmailInterface $inputEmail
* @param string $expectedEmail
*/
public function testDefault(EmailInterface $inputEmail, string $expectedEmail)
{
$this->assertEquals($expectedEmail, (new TransparentEmail())->getPrimaryEmail($inputEmail));
}
public function providerDefault()
{
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'],
];
}
private function createServiceCollector(array $classes = []) : ServiceCollectorInterface private function createServiceCollector(array $classes = []) : ServiceCollectorInterface
{ {
$collector = new ServiceCollector(); $collector = new ServiceCollector();