]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/include/OutboundEmail/Bug59310Test.php
Release 6.5.10
[Github/sugarcrm.git] / tests / include / OutboundEmail / Bug59310Test.php
1 <?php
2 require_once('include/OutboundEmail/OutboundEmail.php');
3
4 /**
5  * @ticket 59310
6 */
7 class Bug59310Test extends Sugar_PHPUnit_Framework_TestCase
8 {
9
10     public function tearDown()
11     {
12         $GLOBALS['db']->query("DELETE FROM outbound_email WHERE type='test'");
13     }
14
15     public function getFields() {
16         return array(
17             array('mail_smtpssl'),
18             array('mail_smtpport'),
19             array('mail_smtppass'),
20             array('mail_smtpuser'),
21         );
22     }
23
24     /**
25      * @dataProvider getFields
26      * @param string $field
27      */
28     public function testFieldsEncoding($field)
29     {
30         // testing insert
31         $ob = new OutboundEmail();
32         $ob->type = 'test';
33         $ob->id = create_guid();
34         $ob->new_with_id = true;
35         $ob->name = 'Test '.$ob->id;
36         $ob->user_id = '1';
37         $ob->$field = mt_rand()." test \\ 'test' ".mt_rand();
38         $ob->save();
39         // testing update
40         $ob->new_with_id = false;
41         $ob->name = 'Update '.$ob->id;
42         $ob->user_id = '1';
43         $ob->$field = mt_rand()." test2 \\ 'test2' ".mt_rand();
44         $ob->save();
45     }
46 }