diff options
author | chris <chris@jalakai.co.uk> | 2007-01-25 15:38:48 +0100 |
---|---|---|
committer | chris <chris@jalakai.co.uk> | 2007-01-25 15:38:48 +0100 |
commit | 26b657a1a40c6eb68443bac86ef032a3c4b05fc5 (patch) | |
tree | 83f780dffe02b9f9e0e87b9fd6ce88977605eec4 /_test/cases/inc/mail_isvalid.test.php | |
parent | 0a1d30bfaabbfda6df7f79e1d0d5f616a9a2f897 (diff) | |
download | rpg-26b657a1a40c6eb68443bac86ef032a3c4b05fc5.tar.gz rpg-26b657a1a40c6eb68443bac86ef032a3c4b05fc5.tar.bz2 |
additional unit tests for email addresses
darcs-hash:20070125143848-9b6ab-490215e5feef3a7f6ed268ee03a6cfe4ced1afbb.gz
Diffstat (limited to '_test/cases/inc/mail_isvalid.test.php')
-rw-r--r-- | _test/cases/inc/mail_isvalid.test.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/_test/cases/inc/mail_isvalid.test.php b/_test/cases/inc/mail_isvalid.test.php new file mode 100644 index 000000000..9cb5d0b97 --- /dev/null +++ b/_test/cases/inc/mail_isvalid.test.php @@ -0,0 +1,30 @@ +<?php +// use no mbstring help here +require_once DOKU_INC.'inc/mail.php'; + +class mail_isvalid extends UnitTestCase { + + + function test1(){ + // we test multiple cases here - format: string, repl, additional, test + $tests = array(); + $tests[] = array('bugs@php.net',true); + $tests[] = array('~someone@somewhere.com',true); + $tests[] = array('no+body.here@somewhere.com.au',true); + $tests[] = array("rfc2822+allthesechars_#*!'`/-={}are.legal@somewhere.com.au",true); + $tests[] = array('bugs@php.net1',false); + $tests[] = array('.bugs@php.net1',false); + $tests[] = array('bu..gs@php.net',false); + $tests[] = array('bugs@php..net',false); + $tests[] = array('bugs@.php.net',false); + $tests[] = array('bugs@php.net.',false); + $tests[] = array('bu(g)s@php.net1',false); + $tests[] = array('bu[g]s@php.net1',false); + + foreach($tests as $test){ + $this->assertEqual($test[0].'('.mail_isvalid($test[0]).')',$test[0].'('.(int)$test[1].')'); + } + } + +} +//Setup VIM: ex: et ts=4 enc=utf-8 : |