mirror of
https://github.com/retailcrm/transparent-email.git
synced 2024-11-25 14:56:04 +03:00
55 lines
1.5 KiB
PHP
55 lines
1.5 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace bkrukowski\Gordianus\Tests\Services;
|
||
|
|
||
|
use bkrukowski\Gordianus\Services\YahooCom;
|
||
|
|
||
|
class YahooComTest extends \PHPUnit_Framework_TestCase
|
||
|
{
|
||
|
/**
|
||
|
* @dataProvider providerIsDomainSupported
|
||
|
*
|
||
|
* @param string $domain
|
||
|
* @param bool $result
|
||
|
*/
|
||
|
public function testIsDomainSupported(string $domain, bool $result)
|
||
|
{
|
||
|
$this->assertSame($result, (new YahooCom())->isDomainSupported($domain));
|
||
|
}
|
||
|
|
||
|
public function providerIsDomainSupported()
|
||
|
{
|
||
|
return [
|
||
|
['yahoo.com', true],
|
||
|
['Yahoo.Com', true],
|
||
|
['YAHOO.COM', true],
|
||
|
['hotmail.com', false],
|
||
|
['HotMail.COM', false],
|
||
|
['gmail.com', false],
|
||
|
['tlen.pl', false],
|
||
|
];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @dataProvider providerGetPrimaryEmail
|
||
|
*
|
||
|
* @param string $inputEmail
|
||
|
* @param string $expectedEmail
|
||
|
*/
|
||
|
public function testGetPrimaryEmail(string $inputEmail, string $expectedEmail)
|
||
|
{
|
||
|
$this->assertSame($expectedEmail, (new YahooCom())->getPrimaryEmail($inputEmail));
|
||
|
}
|
||
|
|
||
|
public function providerGetPrimaryEmail()
|
||
|
{
|
||
|
return [
|
||
|
['janedoe@yahoo.com', 'janedoe@yahoo.com'],
|
||
|
['jane.doe@yahoo.com', 'jane.doe@yahoo.com'],
|
||
|
['Jane.Doe@Yahoo.Com', 'jane.doe@yahoo.com'],
|
||
|
['Jane.Doe+receipts@YAHOO.COM', 'jane.doe+receipts@yahoo.com'],
|
||
|
['Jane.Doe-receipts@YAHOO.COM', 'jane.doe-alias@yahoo.com'],
|
||
|
['Jane.Doe-spam-alias@YAHOO.COM', 'jane.doe-alias@yahoo.com'],
|
||
|
];
|
||
|
}
|
||
|
}
|