public function setUp()
{
parent::setUp();
//If somehow this package already exists copy it
if (file_exists('custom/modules/' . $this->package)) {
$this->packageExists = true;
mkdir_recursive('custom/modules/' . $this->package . '_bak');
copy_recursive('custom/modules/' . $this->package, 'custom/modules/' . $this->package . '_bak');
}
//Make the custom package directory and simulate copying the file in
mkdir_recursive('custom/modules/' . $this->package . '/Ext/WirelessLayoutdefs');
$theArray = array($this->package => array('subpanel_setup' => array($this->package . '_accounts' => array('order' => 100, 'module' => 'Contacts', 'subpanel_name' => 'default', 'title_key' => 'LBL_BUG48784TEST', 'get_subpanel_data' => 'Bug48748Test'))));
$theFile = 'custom/modules/' . $this->package . '/Ext/WirelessLayoutdefs/wireless.subpaneldefs.ext.php';
write_array_to_file('layout_defs', $theArray, $theFile);
sugar_chmod('custom/modules/' . $this->package . '/Ext/WirelessLayoutdefs/wireless.subpaneldefs.ext.php', 0655);
global $beanList, $beanFiles, $current_user;
//$beanList['Contacts'] = 'Contact';
//$beanFiles['Bug48784Mock'] = 'modules/Contacts/Contact.php';
//Create an anonymous user for login purposes/
$current_user = SugarTestUserUtilities::createAnonymousUser();
$current_user->status = 'Active';
$current_user->is_admin = 1;
$current_user->save();
$GLOBALS['db']->commit();
// Making sure we commit any changes before continuing
$_SESSION['avail_modules'][$this->package] = 'write';
}