2 require_once 'include/Dashlets/DashletGeneric.php';
7 class Bug41013Test extends Sugar_PHPUnit_Framework_TestCase
9 protected $_moduleName;
11 public function setup()
13 $this->_moduleName = 'TestModuleForDashletLoadLanguageTest'.mt_rand();
15 sugar_mkdir("custom/modules/{$this->_moduleName}/metadata/",null,true);
16 sugar_file_put_contents("custom/modules/{$this->_moduleName}/metadata/dashletviewdefs.php",
17 '<?php $dashletData[\''.$this->_moduleName.'Dashlet\'][\'searchFields\'] = array(); $dashletData[\''.$this->_moduleName.'Dashlet\'][\'columns\'] = array(\'Foo\'); ?>');
21 public function tearDown()
23 if ( is_dir("custom/modules/{$this->_moduleName}") )
24 rmdir_recursive("custom/modules/{$this->_moduleName}");
26 unset($GLOBALS['dashletStrings']);
29 public function testCanLoadCustomMetadataTwiceInARow()
31 $dashlet = new DashletGenericMock();
32 $dashlet->seedBean->module_dir = $this->_moduleName;
34 $dashlet->loadCustomMetadata();
36 $this->assertEquals(array('Foo'),$dashlet->columns);
38 $dashlet->columns = array();
40 $dashlet->loadCustomMetadata();
42 $this->assertEquals(array('Foo'),$dashlet->columns);
46 class DashletGenericMock extends DashletGeneric
48 public function __construct()
52 public function loadCustomMetadata()
54 parent::loadCustomMetadata();