diff --git a/README.md b/README.md index ca3b221..64562ed 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Gordianus clears aliases from email address. Email `John.Doe+alias@gmail.com` wi * [tlen.pl](http://tlen.pl) * [33mail.com](https://www.33mail.com) * [outlook.com](http://outlook.com) +* [yahoo.com](http://mail.yahoo.com) ## Usage diff --git a/src/Gordianus.php b/src/Gordianus.php index 7307ccb..509a255 100644 --- a/src/Gordianus.php +++ b/src/Gordianus.php @@ -7,6 +7,7 @@ use bkrukowski\Gordianus\Services\OutlookCom; use bkrukowski\Gordianus\Services\ServiceInterface; use bkrukowski\Gordianus\Services\TlenPl; use bkrukowski\Gordianus\Services\Www33MailCom; +use bkrukowski\Gordianus\Services\YahooCom; class Gordianus { @@ -14,6 +15,7 @@ class Gordianus const SERVICE_TLEN_PL = TlenPl::class; const SERVICE_WWW_33MAIL_COM = Www33MailCom::class; const SERVICE_OUTLOOK_COM = OutlookCom::class; + const SERVICE_YAHOO_COM = YahooCom::class; /** * Constant ALL_SERVICES can contain different values depends on API version @@ -23,6 +25,7 @@ class Gordianus self::SERVICE_TLEN_PL, self::SERVICE_WWW_33MAIL_COM, self::SERVICE_OUTLOOK_COM, + self::SERVICE_YAHOO_COM, ]; private $services; diff --git a/src/Services/YahooCom.php b/src/Services/YahooCom.php new file mode 100644 index 0000000..2de6cfe --- /dev/null +++ b/src/Services/YahooCom.php @@ -0,0 +1,22 @@ +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'], + ]; + } +} \ No newline at end of file