]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/ModuleInstall/Bug41829Test.php
Added unit tests.
[Github/sugarcrm.git] / tests / ModuleInstall / Bug41829Test.php
1 <?php
2
3 require_once('ModuleInstall/ModuleInstaller.php');
4
5 class Bug41829Test extends Sugar_PHPUnit_Framework_TestCase 
6 {       
7     protected $module_installer;
8     protected $log;
9
10         public function setUp()
11         {
12         $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
13         $this->module_installer = new ModuleInstaller();
14         $this->module_installer->silent = true;
15         $this->module_installer->base_dir = '';
16         $this->module_installer->id_name = 'Bug41829Test';
17         $this->module_installer->installdefs['dcaction'] = array(
18             array(
19                 'from' => '<basepath>/dcaction_file.php',
20             ),
21         );
22             $this->log = $GLOBALS['log'];
23         $GLOBALS['log'] = new SugarMockLogger();
24         }
25
26         public function tearDown()
27         {
28                 SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
29         unset($GLOBALS['current_user']);
30         $GLOBALS['log'] = $this->log;
31         }
32
33     public function testWarningOnUninstallDCActions()
34     {
35         $this->module_installer->uninstall_dcactions();
36
37         $this->assertTrue(in_array('DEBUG: Uninstalling DCActions ...'  . str_replace('<basepath>', $this->module_installer->base_dir,  $this->module_installer->installdefs['dcaction'][0]['from']), $GLOBALS['log']->messages));
38     }
39
40
41 }