summaryrefslogtreecommitdiffstats
path: root/tests/lib/mail/util.php
blob: 04d9d5df2568bd538bac3ab4d4cc1e122538f112 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
 * Copyright (c) 2014 Lukas Reschke <lukas@owncloud.com>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */

namespace Test;
use OCP\Mail\Util;

/**
 * Class Util
 *
 * @package OC\Mail
 */
class UtilTest extends TestCase {

	/**
	 * @return array
	 */
	public function mailAddressProvider() {
		return array(
			array('lukas@owncloud.com', true),
			array('lukas@localhost', true),
			array('lukas@192.168.1.1', true),
			array('lukas@éxämplè.com', true),
			array('asdf', false),
			array('lukas@owncloud.org@owncloud.com', false)
		);
	}

	/**
	 * @dataProvider mailAddressProvider
	 */
	public function testValidateMailAddress($email, $expected) {
		$this->assertSame($expected, Util::validateMailAddress($email));
	}
}