transparent-email/tests/Services/YahooComTest.php

58 lines
1.6 KiB
PHP
Raw Normal View History

2016-09-10 14:33:57 +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 14:33:57 +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\YahooCom;
2016-09-10 14:33:57 +03:00
class YahooComTest extends \PHPUnit_Framework_TestCase
{
/**
2016-09-24 13:09:20 +03:00
* @dataProvider providerIsSupported
2016-09-10 14:33:57 +03:00
*
* @param string $domain
* @param bool $result
*/
public function testIsDomainSupported(string $domain, bool $result)
{
2016-09-24 13:09:20 +03:00
$this->assertSame($result, (new YahooCom())->isSupported(new Email('Jane.Doe@' . $domain, true)));
2016-09-10 14:33:57 +03:00
}
2016-09-24 13:09:20 +03:00
public function providerIsSupported()
2016-09-10 14:33:57 +03:00
{
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)
{
2016-09-24 13:09:20 +03:00
$this->assertEquals($expectedEmail, (new YahooCom())->getPrimaryEmail(new Email($inputEmail, true)));
2016-09-10 14:33:57 +03:00
}
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'],
2016-09-10 15:45:30 +03:00
['Jane.Doe-receipts@YAHOO.COM', 'jane.doe@yahoo.com'],
['Jane.Doe-spam-alias@YAHOO.COM', 'jane.doe@yahoo.com'],
2016-09-10 14:33:57 +03:00
];
}
}