2014-03-24 16:46:31 +04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Copyright (c) 2014 Thomas Müller <deepdiver@owncloud.com>
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
|
|
|
|
2014-11-11 00:59:50 +03:00
|
|
|
class Test_Mail extends \Test\TestCase {
|
2014-03-24 16:46:31 +04:00
|
|
|
|
2014-03-26 14:17:23 +04:00
|
|
|
protected function setUp()
|
|
|
|
{
|
2014-11-11 00:59:50 +03:00
|
|
|
parent::setUp();
|
|
|
|
|
2014-03-26 14:17:23 +04:00
|
|
|
if (!function_exists('idn_to_ascii')) {
|
|
|
|
$this->markTestSkipped(
|
|
|
|
'The intl extension is not available.'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-24 16:46:31 +04:00
|
|
|
/**
|
|
|
|
* @dataProvider buildAsciiEmailProvider
|
|
|
|
* @param $expected
|
|
|
|
* @param $address
|
|
|
|
*/
|
|
|
|
public function testBuildAsciiEmail($expected, $address) {
|
|
|
|
$actual = \OC_Mail::buildAsciiEmail($address);
|
|
|
|
$this->assertEquals($expected, $actual);
|
|
|
|
}
|
|
|
|
|
|
|
|
function buildAsciiEmailProvider() {
|
|
|
|
return array(
|
|
|
|
array('info@example.com', 'info@example.com'),
|
|
|
|
array('info@xn--cjr6vy5ejyai80u.com', 'info@國際化域名.com'),
|
|
|
|
array('info@xn--mller-kva.de', 'info@müller.de'),
|
|
|
|
array('info@xn--mller-kva.xn--mller-kva.de', 'info@müller.müller.de'),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|