]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/modules/Emails/HandleBodyInHTMLformatTest.php
Added unit tests.
[Github/sugarcrm.git] / tests / modules / Emails / HandleBodyInHTMLformatTest.php
1 <?php 
2 require_once('modules/Emails/Email.php');
3 require_once('include/SugarPHPMailer.php');
4
5 /**
6  * Test cases for Bug 30591
7  */
8 class handleBodyInHTMLformatTest extends Sugar_PHPUnit_Framework_TestCase
9 {
10         private $sugarMailer;
11         private $email;
12         
13         public function setUp()
14         {
15             global $current_user;
16             
17             $current_user = SugarTestUserUtilities::createAnonymousUser();
18                 $this->sugarMailer = new SugarPHPMailer();
19                 $this->email = new Email();
20         }
21         
22         public function tearDown()
23         {
24                 SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
25         unset($GLOBALS['current_user']);
26         }
27         
28         public function testHandleBodyInHtmlformat ()
29         {
30                 $emailBodyInHtml = <<<EOQ
31 Check to see if &quot; &lt; &gt; &#039; was translated
32 to " < > '
33 EOQ;
34
35                 $emailBodyInHtmlResult = <<<EOQ
36 Check to see if " < > ' was translated
37 to " < > '
38 EOQ;
39                 $this->email->description_html = $emailBodyInHtml;
40                 $this->assertNotEquals($this->sugarMailer->Body, $emailBodyInHtmlResult);
41                 $this->email->handleBodyInHTMLformat($this->sugarMailer);
42                 $this->assertEquals($this->sugarMailer->Body, $emailBodyInHtmlResult);
43         }
44 }
45 ?>