[ Index ] |
PHP Cross Reference of DokuWiki |
[Summary view] [Print] [Text view]
1 <?php 2 3 class mail_isvalid_test extends DokuWikiTest { 4 5 public function provider() { 6 return array( 7 // our own tests 8 array('bugs@php.net', true), 9 array('~someone@somewhere.com', true), 10 array('no+body.here@somewhere.com.au', true), 11 array('username+tag@domain.com', true), // FS#1447 12 array("rfc2822+allthesechars_#*!'`/-={}are.legal@somewhere.com.au", true), 13 array('_foo@test.com', true), // FS#1049 14 array('bugs@php.net1', true), // new ICAN rulez seem to allow this 15 array('.bugs@php.net1', false), 16 array('bu..gs@php.net', false), 17 array('bugs@php..net', false), 18 array('bugs@.php.net', false), 19 array('bugs@php.net.', false), 20 array('bu(g)s@php.net1', false), 21 array('bu[g]s@php.net1', false), 22 array('somebody@somewhere.museum', true), 23 array('somebody@somewhere.travel', true), 24 array('root@[2010:fb:fdac::311:2101]', true), 25 array('test@example', true), // we allow local addresses 26 27 // tests from http://code.google.com/p/php-email-address-validation/ below 28 29 array('test@example.com', true), 30 array('TEST@example.com', true), 31 array('1234567890@example.com', true), 32 array('test+test@example.com', true), 33 array('test-test@example.com', true), 34 array('t*est@example.com', true), 35 array('+1~1+@example.com', true), 36 array('{_test_}@example.com', true), 37 array('"[[ test ]]"@example.com', true), 38 array('test.test@example.com', true), 39 array('test."test"@example.com', true), 40 array('"test@test"@example.com', true), 41 array('test@123.123.123.123', true), 42 array('test@[123.123.123.123]', true), 43 array('test@example.example.com', true), 44 array('test@example.example.example.com', true), 45 46 array('test.example.com', false), 47 array('test.@example.com', false), 48 array('test..test@example.com', false), 49 array('.test@example.com', false), 50 array('test@test@example.com', false), 51 array('test@@example.com', false), 52 array('-- test --@example.com', false), // No spaces allowed in local part 53 array('[test]@example.com', false), // Square brackets only allowed within quotes 54 array('"test\test"@example.com', false), // Quotes cannot contain backslash 55 array('"test"test"@example.com', false), // Quotes cannot be nested 56 array('()[]\;:,<>@example.com', false), // Disallowed Characters 57 array('test@.', false), 58 array('test@example.', false), 59 array('test@.org', false), 60 array('12345678901234567890123456789012345678901234567890123456789012345@example.com', false), // 64 characters is maximum length for local part. This is 65. 61 array('test@123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012.com', false), // 255 characters is maximum length for domain. This is 256. 62 array('test@[123.123.123.123', false), 63 array('test@123.123.123.123]', false), 64 ); 65 } 66 67 /** 68 * @dataProvider provider 69 * @param string $input 70 * @param bool $success 71 */ 72 function test1($input, $success) { 73 $result = mail_isvalid($input); 74 $this->assertSame($success, $result); 75 } 76 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body