2 require_once('include/MVC/View/SugarView.php');
4 class Bug40019Test extends Sugar_PHPUnit_Framework_TestCase
6 public function setUp()
8 $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
11 $max = $sugar_config['history_max_viewed'];
14 for($i = 0; $i < $max + 1; $i++){
15 $contacts[$i] = SugarTestContactUtilities::createContact();
16 SugarTestTrackerUtility::insertTrackerEntry($contacts[$i], 'detailview');
19 for($i = 0; $i < $max + 1; $i++){
20 $account[$i] = SugarTestAccountUtilities::createAccount();
21 SugarTestTrackerUtility::insertTrackerEntry($account[$i], 'detailview');
24 $GLOBALS['app_strings'] = return_application_language($GLOBALS['current_language']);
27 public function tearDown()
29 SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
30 SugarTestContactUtilities::removeAllCreatedContacts();
31 SugarTestAccountUtilities::removeAllCreatedAccounts();
32 SugarTestTrackerUtility::removeAllTrackerEntries();
33 unset($GLOBALS['current_user']);
34 unset($GLOBALS['app_strings']);
37 // Currently, getBreadCrumbList in BreadCrumbStack.php limits you to 10
38 // Also, the Constructor in BreadCrumbStack.php limits it to 10 too.
42 public function testModuleMenuLastViewedForModule()
45 $max = $sugar_config['history_max_viewed'];
47 $tracker = new Tracker();
48 $history = $tracker->get_recently_viewed($GLOBALS['current_user']->id, 'Contacts');
50 $expected = $max > 10 ? 10 : $max;
52 $this->assertTrue(count($history) == $expected);
55 // Currently, getBreadCrumbList in BreadCrumbStack.php limits you to 10
59 public function testModuleMenuLastViewedForAll()
62 $max = $sugar_config['history_max_viewed'];
64 $tracker = new Tracker();
65 $history = $tracker->get_recently_viewed($GLOBALS['current_user']->id, '');
67 $expected = $max > 10 ? 10 : $max;
69 $this->assertTrue(count($history) == $expected);