/** * Ensure that a history item is created when SugarMerge executes and that the file contents are identical. * */ function testHistoryCreationForUpgradedMetadataFiles() { $accountsHistoryMetadataLocation = 'custom/history/modules/Accounts/metadata'; $this->clearFilesInDirectory('custom/modules/Accounts/metadata'); $this->clearFilesInDirectory($accountsHistoryMetadataLocation); $customFile = "tests/modules/UpgradeWizard/SugarMerge/od_metadata_files/610/custom/modules/Accounts/metadata/detailviewdefs.php"; $customFileTo = "custom/modules/Accounts/metadata/detailviewdefs.php"; copy($customFile, $customFileTo); require_once 'modules/UpgradeWizard/SugarMerge/SugarMerge.php'; $sugar_merge = new SugarMerge('tests/modules/UpgradeWizard/SugarMerge/od_metadata_files/610/custom'); $mergedFiles = $sugar_merge->mergeModule('Accounts'); $this->assertTrue(file_exists('custom/modules/Accounts/metadata/detailviewdefs.php'), "Custom metadata file not created."); $this->assertTrue($this->checkForHistoryRecords('Accounts')); //Ensure history file and custom file are the same. $oldCustomFile = file_get_contents($customFile); $newHistoryFile = $this->getFirstFileContentsInDirectory($accountsHistoryMetadataLocation); $this->assertEquals($oldCustomFile, $newHistoryFile, "Error previous custom file before merge and new history record are not identical."); }
function test_project_merge() { require_once 'modules/UpgradeWizard/SugarMerge/SugarMerge.php'; $sugar_merge = new SugarMerge('tests/modules/UpgradeWizard/SugarMerge/od_metadata_files/custom'); $sugar_merge->mergeModule('Project'); $this->assertTrue(file_exists('custom/modules/Project/metadata/detailviewdefs.php.suback.php')); $this->assertTrue(file_exists('custom/modules/Project/metadata/editviewdefs.php.suback.php')); require 'custom/modules/Project/metadata/detailviewdefs.php'; $this->assertTrue(isset($viewdefs['Project']['DetailView']['panels']['lbl_panel_1']), 'Assert that the original panel index is preserved'); require 'custom/modules/Project/metadata/editviewdefs.php'; $this->assertTrue(isset($viewdefs['Project']['EditView']['panels']['default']), 'Assert that the original panel index is preserved'); }