]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/include/SugarEmailAddress/Bug40068Test.php
Added unit tests.
[Github/sugarcrm.git] / tests / include / SugarEmailAddress / Bug40068Test.php
1 <?php
2 require_once 'include/SugarEmailAddress/SugarEmailAddress.php';
3
4
5 /**
6  * 
7  * Bug 40068
8  *
9  */
10
11 class Bug40068Test extends Sugar_PHPUnit_Framework_TestCase
12 {
13     public function providerEmailAddressRegex()
14         {
15             return array(
16                 array('john@john.com',true),
17                 array('jo&hn@john.com',true),
18                 array('joh#n@john.com.br',true),
19                 array('&#john@john.com', true),
20                 array('atendimento-hd.@uol.com.br',true),
21                 );
22         }
23     
24     /**
25      * @group bug40068
26      * @dataProvider providerEmailAddressRegex
27      */
28         public function testEmailAddressRegex($email, $valid) 
29     {
30         $sea = new SugarEmailAddress;
31         
32         if ( $valid ) {
33             $this->assertRegExp($sea->regex,$email);
34         }
35         else {
36             $this->assertNotRegExp($sea->regex,$email);
37         }     
38     }
39 }