diff options
author | defa <defa@so36.net> | 2012-09-05 14:48:55 +0200 |
---|---|---|
committer | defa <defa@so36.net> | 2012-09-05 14:48:55 +0200 |
commit | 921408eba600a7dc51271c35480e9114cac5ecec (patch) | |
tree | 8728fecce574a1a70f623311b315360564708360 /tests | |
parent | 5c603c4032bf71792e7accd80e2b7d0e78d445f8 (diff) | |
parent | e263994adc3f8f331c6167da1665c1920a5142f9 (diff) |
Merge https://github.com/roundcube/roundcubemail into crypt_hash_branch
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Framework/Shared.php | 43 | ||||
-rw-r--r-- | tests/HtmlToText.php | 4 | ||||
-rw-r--r-- | tests/MailFunc.php | 2 | ||||
-rw-r--r-- | tests/phpunit.xml | 4 |
4 files changed, 50 insertions, 3 deletions
diff --git a/tests/Framework/Shared.php b/tests/Framework/Shared.php index d38fb03a3..99ef829da 100644 --- a/tests/Framework/Shared.php +++ b/tests/Framework/Shared.php @@ -158,4 +158,47 @@ class Framework_Shared extends PHPUnit_Framework_TestCase $this->assertEquals($input_str, $result_str, "Invalid array_keys_recursive() result"); } + + /** + * rcube_shared.inc: format_email() + */ + function test_format_email() + { + $data = array( + '' => '', + 'test' => 'test', + 'test@test.tld' => 'test@test.tld', + 'test@[127.0.0.1]' => 'test@[127.0.0.1]', + 'TEST@TEST.TLD' => 'TEST@test.tld', + ); + + foreach ($data as $value => $expected) { + $result = format_email($value); + $this->assertEquals($expected, $result, "Invalid format_email() result for $value"); + } + + } + + /** + * rcube_shared.inc: format_email_recipient() + */ + function test_format_email_recipient() + { + $data = array( + '' => array(''), + 'test' => array('test'), + 'test@test.tld' => array('test@test.tld'), + 'test@[127.0.0.1]' => array('test@[127.0.0.1]'), + 'TEST@TEST.TLD' => array('TEST@TEST.TLD'), + 'TEST <test@test.tld>' => array('test@test.tld', 'TEST'), + '"TEST\"" <test@test.tld>' => array('test@test.tld', 'TEST"'), + ); + + foreach ($data as $expected => $value) { + $result = format_email_recipient($value[0], $value[1]); + $this->assertEquals($expected, $result, "Invalid format_email_recipient()"); + } + + } + } diff --git a/tests/HtmlToText.php b/tests/HtmlToText.php index 34e2d1a63..b90c61adf 100644 --- a/tests/HtmlToText.php +++ b/tests/HtmlToText.php @@ -8,7 +8,7 @@ class HtmlToText extends PHPUnit_Framework_TestCase { - function data() + function data_html2text() { return array( 0 => array( @@ -45,7 +45,7 @@ class HtmlToText extends PHPUnit_Framework_TestCase } /** - * @dataProvider data + * @dataProvider data_html2text */ function test_html2text($title, $in, $out) { diff --git a/tests/MailFunc.php b/tests/MailFunc.php index 57a6b9d10..967277c2a 100644 --- a/tests/MailFunc.php +++ b/tests/MailFunc.php @@ -8,7 +8,7 @@ class MailFunc extends PHPUnit_Framework_TestCase { - function __construct() + function setUp() { // simulate environment to successfully include func.inc $GLOBALS['RCMAIL'] = $RCMAIL = rcmail::get_instance(); diff --git a/tests/phpunit.xml b/tests/phpunit.xml index 28f7e7420..8b3883223 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -29,5 +29,9 @@ <file>HtmlToText.php</file> <file>MailFunc.php</file> </testsuite> + <testsuite name="managesieve"> + <file>./../plugins/managesieve/tests/Parser.php</file> + <file>./../plugins/managesieve/tests/Tokenizer.php</file> + </testsuite> </testsuites> </phpunit> |