]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/modules/InboundEmail/AutoCreateImportFolderTest.php
Added unit tests.
[Github/sugarcrm.git] / tests / modules / InboundEmail / AutoCreateImportFolderTest.php
1 <?php 
2 require_once('include/SugarFolders/SugarFolders.php');
3 require_once('modules/InboundEmail/InboundEmail.php');
4
5 /**
6  * @group bug33404
7  */
8 class AutoCreateImportFolderTest extends Sugar_PHPUnit_Framework_TestCase
9 {
10         var $folder_id = null;
11         var $folder_obj = null;
12         var $ie = null;
13     var $_user = null;
14     
15     
16         public function setUp()
17     {
18         global $current_user, $currentModule;
19
20         $this->_user = SugarTestUserUtilities::createAnonymousUser();
21         $GLOBALS['current_user'] = $this->_user;
22         
23                 $this->folder = new SugarFolder(); 
24                 $this->ie = new InboundEmail();
25         }
26
27     public function tearDown()
28     {
29         SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
30         unset($GLOBALS['current_user']);
31         
32         $GLOBALS['db']->query("DELETE FROM folders WHERE id='{$this->folder_id}'");
33         
34         unset($this->ie);
35     }
36     
37         function testAutoImportFolderCreation(){
38             global $current_user;
39            
40         $this->ie->name = "Sugar Test";
41         $this->folder_id = $this->ie->createAutoImportSugarFolder();
42             $this->folder_obj = new SugarFolder();
43             $this->folder_obj->retrieve($this->folder_id);
44                 
45                 $this->assertEquals($this->ie->name, $this->folder_obj->name, "Could not create folder for Inbound Email auto folder creation" );
46         $this->assertEquals(0, $this->folder_obj->has_child, "Could not create folder for Inbound Email auto folder creation" );
47         $this->assertEquals(1, $this->folder_obj->is_group, "Could not create folder for Inbound Email auto folder creation" );
48         $this->assertEquals($this->_user->id, $this->folder_obj->assign_to_id, "Could not create folder for Inbound Email auto folder creation" );
49         
50         }
51 }
52 ?>