transparent-email/tests/Services/GmailComTest.php

51 lines
1.3 KiB
PHP
Raw Normal View History

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\GmailCom;
2016-09-10 01:41:21 +03:00
2016-09-10 11:50:57 +03:00
class GmailComTest extends \PHPUnit_Framework_TestCase
2016-09-10 01:41:21 +03:00
{
/**
* @dataProvider providerGetPrimaryEmail
*
* @param string $inputEmail
* @param string $outputEmail
*/
public function testGetPrimaryEmail(string $inputEmail, string $outputEmail)
{
2016-09-10 11:50:57 +03:00
$this->assertSame($outputEmail, (new GmailCom())->getPrimaryEmail($inputEmail));
2016-09-10 01:41:21 +03:00
}
public function providerGetPrimaryEmail()
{
return [
['foo.bar@gmail.com', 'foobar@gmail.com'],
['Foo.Bar@GMAIL.COM', 'foobar@gmail.com'],
2016-09-10 01:41:21 +03:00
['foobar+alias@gmail.com', 'foobar@gmail.com'],
['fo.ob.ar+alias@gmail.com', 'foobar@gmail.com'],
];
}
/**
* @dataProvider providerIsDomainSupported
*
* @param string $domain
* @param bool $result
*/
public function testIsDomainSupported(string $domain, bool $result)
{
2016-09-10 11:50:57 +03:00
$this->assertSame($result, (new GmailCom())->isDomainSupported($domain));
2016-09-10 01:41:21 +03:00
}
public function providerIsDomainSupported()
{
return [
['gmail.com', true],
['gmail.COM', true],
2016-09-10 01:41:21 +03:00
['google.com', false],
['gmailcom', false],
['g.mail.com', false]
];
}
}