opportunity_name = 'SBizzle Dollar Store'; $lead->save(); $_REQUEST['module'] = 'Leads'; $_REQUEST['action'] = 'ConvertLead'; $_REQUEST['record'] = $lead->id; // Check that the opportunity name doesn't get populated when it's not in the Leads editview layout require_once('include/MVC/Controller/ControllerFactory.php'); require_once('include/MVC/View/ViewFactory.php'); $GLOBALS['app']->controller = ControllerFactory::getController($_REQUEST['module']); ob_start(); $GLOBALS['app']->controller->execute(); $output = ob_get_clean(); $matches_one = array(); $pattern = '/SBizzle Dollar Store/'; preg_match($pattern, $output, $matches_one); $this->assertTrue(count($matches_one) == 0, "Opportunity name got carried over to the Convert Leads page when it shouldn't have."); // Add the opportunity_name to the Leads EditView SugarTestStudioUtilities::addFieldToLayout('Leads', 'editview', 'opportunity_name'); // Check that the opportunity name now DOES get populated now that it's in the Leads editview layout ob_start(); $GLOBALS['app']->controller = ControllerFactory::getController($_REQUEST['module']); $GLOBALS['app']->controller->execute(); $output = ob_get_clean(); $matches_two = array(); $pattern = '/SBizzle Dollar Store/'; preg_match($pattern, $output, $matches_two); $this->assertTrue(count($matches_two) > 0, "Opportunity name did not carry over to the Convert Leads page when it should have."); SugarTestStudioUtilities::removeAllCreatedFields(); unset($GLOBALS['app']->controller); unset($_REQUEST['module']); unset($_REQUEST['action']); unset($_REQUEST['record']); SugarTestLeadUtilities::removeAllCreatedLeads(); } }