summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-01-22 15:17:29 +0100
committerMorris Jobke <hey@morrisjobke.de>2015-01-22 17:26:13 +0100
commit491c714f543b03950c2f9b586f8646059c9b24ca (patch)
treeab4e1f355783ff1b2fbaa30e19437018890552f8 /tests
parent8459b9f6fb2e990941fd7099ecc9dfc2b4a2fa7f (diff)
downloadnextcloud-server-491c714f543b03950c2f9b586f8646059c9b24ca.tar.gz
nextcloud-server-491c714f543b03950c2f9b586f8646059c9b24ca.zip
Fix undefined offset 1 for wrong user mail address
* fixes Undefined offset: 1 at lib/private/mail.php#143
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/mail.php34
1 files changed, 24 insertions, 10 deletions
diff --git a/tests/lib/mail.php b/tests/lib/mail.php
index 3cc9868e25e..6af977a9539 100644
--- a/tests/lib/mail.php
+++ b/tests/lib/mail.php
@@ -8,26 +8,23 @@
class Test_Mail extends PHPUnit_Framework_TestCase {
- protected function setUp()
- {
- if (!function_exists('idn_to_ascii')) {
- $this->markTestSkipped(
- 'The intl extension is not available.'
- );
- }
- }
-
/**
* @dataProvider buildAsciiEmailProvider
* @param $expected
* @param $address
*/
public function testBuildAsciiEmail($expected, $address) {
+ if (!function_exists('idn_to_ascii')) {
+ $this->markTestSkipped(
+ 'The intl extension is not available.'
+ );
+ }
+
$actual = \OC_Mail::buildAsciiEmail($address);
$this->assertEquals($expected, $actual);
}
- function buildAsciiEmailProvider() {
+ public function buildAsciiEmailProvider() {
return array(
array('info@example.com', 'info@example.com'),
array('info@xn--cjr6vy5ejyai80u.com', 'info@國際化域名.com'),
@@ -36,4 +33,21 @@ class Test_Mail extends PHPUnit_Framework_TestCase {
);
}
+ public function validateMailProvider() {
+ return array(
+ array('infoatexample.com', false),
+ array('info', false),
+ );
+ }
+
+ /**
+ * @dataProvider validateMailProvider
+ * @param $address
+ * @param $expected
+ */
+ public function testValidateEmail($address, $expected) {
+ $actual = \OC_Mail::validateAddress($address);
+ $this->assertEquals($expected, $actual);
+ }
+
}