2 require_once 'include/dir_inc.php';
4 class Bug36481Test extends Sugar_PHPUnit_Framework_TestCase {
7 var $has_contacts_dir = false;
8 var $has_suback_file = false;
12 if(!isset($current_user)) {
13 $current_user = SugarTestUserUtilities::createAnonymousUser();
15 if(!file_exists("custom/modules/Contacts/metadata")){
16 mkdir_recursive("custom/modules/Contacts/metadata", true);
19 if(file_exists('custom/modules/Contacts/metadata/editviewdefs.php')) {
20 $this->has_contacts_dir = true;
21 copy('custom/modules/Contacts/metadata/editviewdefs.php', 'custom/modules/Contacts/metadata/editviewdefs.php.bak');
24 $this->has_suback_file = file_exists('custom/modules/Contacts/metadata/editviewdefs.php.suback.php');
26 copy('tests/modules/UpgradeWizard/SugarMerge/metadata_files/custom/modules/Contacts/metadata/editviewdefs.php', 'custom/modules/Contacts/metadata/editviewdefs.php');
31 if(!$this->has_contacts_dir) {
32 rmdir_recursive('custom/modules/Contacts');
33 } else if(file_exists('custom/modules/Contacts/metadata/editviewdefs.php.bak')) {
34 copy('custom/modules/Contacts/metadata/editviewdefs.php.bak', 'custom/modules/Contacts/metadata/editviewdefs.php');
35 unlink('custom/modules/Contacts/metadata/editviewdefs.php.bak');
37 if(!$this->has_suback_file) {
38 unlink('custom/modules/Contacts/metadata/editviewdefs.php.suback.php');
45 function test_contacts_editview_merge() {
46 require_once('modules/UpgradeWizard/SugarMerge/EditViewMerge.php');
47 $this->ev_merge = new EditViewMerge();
48 $this->ev_merge->merge('Contacts', 'tests/modules/UpgradeWizard/SugarMerge/metadata_files/550/modules/Contacts/metadata/editviewdefs.php', 'modules/Contacts/metadata/editviewdefs.php', 'custom/modules/Contacts/metadata/editviewdefs.php');
49 $this->assertTrue(file_exists('custom/modules/Contacts/metadata/editviewdefs.php.suback.php'));
50 require('custom/modules/Contacts/metadata/editviewdefs.php');
52 foreach($viewdefs['Contacts']['EditView']['panels'] as $panel) {
53 foreach($panel as $row) {
54 foreach($row as $col_key=>$col) {
55 $id = is_array($col) && isset($col['name']) ? $col['name'] : $col;
61 $this->assertTrue(isset($fields['test_c']), 'Assert that test_c custom field exists');