2016-09-10 01:41:21 +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 01:41:21 +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\Www33MailCom;
|
2020-02-13 16:27:05 +03:00
|
|
|
use PHPUnit\Framework\TestCase;
|
2016-09-10 01:41:21 +03:00
|
|
|
|
2020-02-13 16:27:05 +03:00
|
|
|
class Www33MailComTest extends TestCase
|
2016-09-10 01:41:21 +03:00
|
|
|
{
|
|
|
|
/**
|
2016-09-24 13:09:20 +03:00
|
|
|
* @dataProvider providerIsSupported
|
2016-09-10 01:41:21 +03:00
|
|
|
*
|
|
|
|
* @param string $domain
|
|
|
|
* @param bool $isSupported
|
|
|
|
*/
|
2016-09-24 13:09:20 +03:00
|
|
|
public function testIsSupported(string $domain, bool $isSupported)
|
2016-09-10 01:41:21 +03:00
|
|
|
{
|
2016-09-24 13:09:20 +03:00
|
|
|
$this->assertSame($isSupported, (new Www33MailCom())->isSupported(new Email('Jane.Doe@' . $domain, true)));
|
2016-09-10 01:41:21 +03:00
|
|
|
}
|
|
|
|
|
2016-10-14 21:25:52 +03:00
|
|
|
public function providerIsSupported() : array
|
2016-09-10 01:41:21 +03:00
|
|
|
{
|
|
|
|
return [
|
|
|
|
['foo.33mail.com', true],
|
|
|
|
['bar.33mail.com', true],
|
2016-09-10 02:39:01 +03:00
|
|
|
['bar.33Mail.Com', true],
|
2016-09-10 01:41:21 +03:00
|
|
|
['foo.34mail.com', false],
|
|
|
|
['foo33mail.com', 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 Www33MailCom())->getPrimaryEmail(new Email($inputEmail, true)));
|
2016-09-10 01:41:21 +03:00
|
|
|
}
|
|
|
|
|
2016-10-14 21:25:52 +03:00
|
|
|
public function providerGetPrimaryEmail() : array
|
2016-09-10 01:41:21 +03:00
|
|
|
{
|
|
|
|
return [
|
|
|
|
['qwerty@name.33mail.com', 'name@name.33mail.com'],
|
|
|
|
['lorem@ipsum.33mail.com', 'ipsum@ipsum.33mail.com'],
|
2016-09-10 02:39:01 +03:00
|
|
|
['lorem@Ipsum.33mail.com', 'ipsum@ipsum.33mail.com'],
|
2016-09-10 01:41:21 +03:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|