mail.php 972 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * Copyright (c) 2014 Thomas Müller <deepdiver@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. class Test_Mail extends PHPUnit_Framework_TestCase {
  9. protected function setUp()
  10. {
  11. if (!function_exists('idn_to_ascii')) {
  12. $this->markTestSkipped(
  13. 'The intl extension is not available.'
  14. );
  15. }
  16. }
  17. /**
  18. * @dataProvider buildAsciiEmailProvider
  19. * @param $expected
  20. * @param $address
  21. */
  22. public function testBuildAsciiEmail($expected, $address) {
  23. $actual = \OC_Mail::buildAsciiEmail($address);
  24. $this->assertEquals($expected, $actual);
  25. }
  26. function buildAsciiEmailProvider() {
  27. return array(
  28. array('info@example.com', 'info@example.com'),
  29. array('info@xn--cjr6vy5ejyai80u.com', 'info@國際化域名.com'),
  30. array('info@xn--mller-kva.de', 'info@müller.de'),
  31. array('info@xn--mller-kva.xn--mller-kva.de', 'info@müller.müller.de'),
  32. );
  33. }
  34. }