2016-09-10 01:41:21 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace bkrukowski\Gordianus\Tests\Services;
|
|
|
|
|
2016-09-10 11:50:57 +03:00
|
|
|
use bkrukowski\Gordianus\Services\Www33MailCom;
|
2016-09-10 01:41:21 +03:00
|
|
|
|
2016-09-10 11:50:57 +03:00
|
|
|
class Www33MailComTest extends \PHPUnit_Framework_TestCase
|
2016-09-10 01:41:21 +03:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @dataProvider providerIsDomainSupported
|
|
|
|
*
|
|
|
|
* @param string $domain
|
|
|
|
* @param bool $isSupported
|
|
|
|
*/
|
|
|
|
public function testIsDomainSupported(string $domain, bool $isSupported)
|
|
|
|
{
|
2016-09-10 11:50:57 +03:00
|
|
|
$this->assertSame($isSupported, (new Www33MailCom())->isDomainSupported($domain));
|
2016-09-10 01:41:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function providerIsDomainSupported()
|
|
|
|
{
|
|
|
|
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-10 11:50:57 +03:00
|
|
|
$this->assertSame($expectedEmail, (new Www33MailCom())->getPrimaryEmail($inputEmail));
|
2016-09-10 01:41:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function providerGetPrimaryEmail()
|
|
|
|
{
|
|
|
|
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
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|