transparent-email/tests/Services/Www33MailComTest.php

53 lines
1.4 KiB
PHP
Raw Normal View History

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;
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
{
/**
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-09-24 13:09:20 +03:00
public function providerIsSupported()
2016-09-10 01:41:21 +03:00
{
return [
['foo.33mail.com', true],
['bar.33mail.com', true],
['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
}
public function providerGetPrimaryEmail()
{
return [
['qwerty@name.33mail.com', 'name@name.33mail.com'],
['lorem@ipsum.33mail.com', 'ipsum@ipsum.33mail.com'],
['lorem@Ipsum.33mail.com', 'ipsum@ipsum.33mail.com'],
2016-09-10 01:41:21 +03:00
];
}
}