transparent-email/tests/Services/OutlookComTest.php

57 lines
1.6 KiB
PHP
Raw Normal View History

2016-09-10 13:15:37 +03:00
<?php
2016-09-23 22:39:33 +03:00
declare(strict_types=1);
2016-09-10 16:13:55 +03:00
namespace bkrukowski\TransparentEmail\Tests\Services;
2016-09-10 13:15:37 +03:00
2016-09-24 13:09:20 +03:00
use bkrukowski\TransparentEmail\Emails\Email;
2016-09-10 16:13:55 +03:00
use bkrukowski\TransparentEmail\Services\OutlookCom;
2020-02-13 16:27:05 +03:00
use PHPUnit\Framework\TestCase;
2016-09-10 13:15:37 +03:00
2020-02-13 16:27:05 +03:00
class OutlookComTest extends TestCase
2016-09-10 13:15:37 +03:00
{
/**
2016-09-24 13:09:20 +03:00
* @dataProvider providerIsSupported
2016-09-10 13:15:37 +03:00
*
* @param string $domain
* @param bool $result
*/
2016-09-24 13:09:20 +03:00
public function testIsSupported(string $domain, bool $result)
2016-09-10 13:15:37 +03:00
{
2016-09-24 13:09:20 +03:00
$this->assertSame($result, (new OutlookCom())->isSupported(new Email('Jane.Doe@' . $domain, true)));
2016-09-10 13:15:37 +03:00
}
2016-10-14 21:25:52 +03:00
public function providerIsSupported() : array
2016-09-10 13:15:37 +03:00
{
return [
['outlook.com', true],
['Outlook.Com', true],
['hotmail.com', true],
['HotMail.COM', true],
['gmail.com', false],
['tlen.pl', false],
];
}
/**
* @dataProvider providerGetPrimaryEmail
*
* @param string $inputEmail
* @param string $expectedEmail
*/
public function testGetPrimaryEmail(string $inputEmail, string $expectedEmail)
{
2016-09-24 13:09:20 +03:00
$this->assertEquals($expectedEmail, (new OutlookCom())->getPrimaryEmail(new Email($inputEmail, true)));
2016-09-10 13:15:37 +03:00
}
2016-10-14 21:25:52 +03:00
public function providerGetPrimaryEmail() : array
2016-09-10 13:15:37 +03:00
{
return [
['janedoe@outlook.com', 'janedoe@outlook.com'],
['jane.doe@outlook.com', 'jane.doe@outlook.com'],
['Jane.Doe@Outlook.Com', 'jane.doe@outlook.com'],
['Jane.Doe+alias@OUTLOOK.COM', 'jane.doe@outlook.com'],
['Jane.Doe+Hotmail@hotmail.com', 'jane.doe@hotmail.com'],
];
}
}