]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/modules/ModuleBuilder/MB/Bug38281Test.php
Release 6.3.0beta1
[Github/sugarcrm.git] / tests / modules / ModuleBuilder / MB / Bug38281Test.php
1 <?php
2 require_once 'modules/ModuleBuilder/MB/MBModule.php';
3
4 class Bug38281Test extends Sugar_PHPUnit_Framework_TestCase
5 {
6     private $tmp_dir;
7     private $tmp_file;
8
9     public function setUp()
10     {
11         $this->tmp_dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'bug32821';
12         mkdir($this->tmp_dir);
13         $this->tmp_file = tempnam($this->tmp_dir, 'bug32821');
14         file_put_contents($this->tmp_file, '$dashletData[\'oldnameDashlet\'][\'searchFields\']');
15     }
16
17     public function tearDown()
18     {
19         unlink($this->tmp_file);
20         rmdir($this->tmp_dir);
21     }
22
23     /**
24      * @group bug38281
25      */
26     public function testRenameMetaData()
27     {
28         $mbModule = new MBModule('newname', $this->tmp_dir, 'test', 'test');
29         $mbModule->renameMetaData($this->tmp_dir, 'oldname');
30         $replacedContents = file_get_contents($this->tmp_file);
31         $this->assertEquals('$dashletData[\'test_newnameDashlet\'][\'searchFields\']', $replacedContents, 'Module name replaced correctly in dashlet metadata');
32     }
33 }