0
0
Fork 0
mirror of https://github.com/salesagility/SuiteCRM.git synced 2025-02-21 20:56:08 +00:00
salesagility_SuiteCRM/tests/unit/phpunit/modules/Trackers/TrackerTest.php
j.dang f1ac628023 Replace explicit bean instantiations in files 141 - 150
- File: '... /tests/unit/phpunit/modules/EmailMan/EmailManTest.php'

   - Replaced 15 occurrence(s) of 'new EmailMan()'

   - Replaced 2 occurrence(s) of 'new Contact()'

   - Replaced 3 occurrence(s) of 'new Email()'

   - Replaced 1 occurrence(s) of 'new User()'

- File: '... /tests/unit/phpunit/modules/Employees/EmployeeTest.php'

   - Replaced 1 occurrence(s) of 'new User()'

   - Replaced 12 occurrence(s) of 'new Employee()'

- File: '... /tests/unit/phpunit/modules/Trackers/TrackerTest.php'

   - Replaced 1 occurrence(s) of 'new User()'

   - Replaced 4 occurrence(s) of 'new Tracker()'

- File: '... /tests/unit/phpunit/modules/Opportunities/OpportunityTest.php'

   - Replaced 18 occurrence(s) of 'new Opportunity()'

   - Replaced 1 occurrence(s) of 'new User()'

- File: '... /tests/unit/phpunit/modules/AOK_Knowledge_Base_Categories/AOK_Knowledge_Base_CategoriesTest.php'

   - Replaced 1 occurrence(s) of 'new AOK_Knowledge_Base_Categories()'

- File: '... /tests/unit/phpunit/modules/AOS_Line_Item_Groups/AOS_Line_Item_GroupsTest.php'

   - Replaced 1 occurrence(s) of 'new User()'

   - Replaced 1 occurrence(s) of 'new AOS_Contracts()'

   - Replaced 3 occurrence(s) of 'new AOS_Line_Item_Groups()'

- File: '... /tests/unit/phpunit/modules/Bugs/BugTest.php'

   - Replaced 13 occurrence(s) of 'new Bug()'

   - Replaced 1 occurrence(s) of 'new User()'

- File: '... /tests/unit/phpunit/modules/EmailMarketing/EmailMarketingTest.php'

   - Replaced 7 occurrence(s) of 'new EmailMarketing()'

- File: '... /tests/unit/phpunit/modules/AOS_Contracts/AOS_ContractsTest.php'

   - Replaced 1 occurrence(s) of 'new User()'

   - Replaced 3 occurrence(s) of 'new AOS_Contracts()'

- File: '... /tests/unit/phpunit/modules/jjwg_Address_Cache/jjwg_Address_CacheTest.php'

   - Replaced 5 occurrence(s) of 'new jjwg_Address_Cache()'
2020-01-22 13:51:01 +00:00

82 lines
2.6 KiB
PHP

<?php
use SuiteCRM\Test\SuitePHPUnitFrameworkTestCase;
class TrackerTest extends SuitePHPUnitFrameworkTestCase
{
public function setUp()
{
parent::setUp();
global $current_user;
get_sugar_config_defaults();
$current_user = BeanFactory::newBean('Users');
}
public function testTracker()
{
// Execute the constructor and check for the Object type and attributes
$tracker = BeanFactory::newBean('Trackers');
$this->assertInstanceOf('Tracker', $tracker);
$this->assertInstanceOf('SugarBean', $tracker);
$this->assertAttributeEquals('tracker', 'table_name', $tracker);
$this->assertAttributeEquals('Trackers', 'module_dir', $tracker);
$this->assertAttributeEquals('Tracker', 'object_name', $tracker);
$this->assertAttributeEquals(true, 'disable_var_defs', $tracker);
$this->assertAttributeEquals('Tracker', 'acltype', $tracker);
$this->assertAttributeEquals('Trackers', 'acl_category', $tracker);
$this->assertAttributeEquals(true, 'disable_custom_fields', $tracker);
}
public function testget_recently_viewed()
{
$tracker = BeanFactory::newBean('Trackers');
$result = $tracker->get_recently_viewed(1);
$this->assertInstanceOf('BreadCrumbStack', $_SESSION['breadCrumbs']);
$this->assertTrue(is_array($result));
}
public function testmakeInvisibleForAll()
{
$tracker = BeanFactory::newBean('Trackers');
// Execute the method and test that it works and doesn't throw an exception.
try {
$tracker->makeInvisibleForAll(1);
$this->assertTrue(true);
} catch (Exception $e) {
$this->fail($e->getMessage() . "\nTrace:\n" . $e->getTraceAsString());
}
}
public function testbean_implements()
{
$tracker = BeanFactory::newBean('Trackers');
$this->assertEquals(false, $tracker->bean_implements('')); //test with blank value
$this->assertEquals(false, $tracker->bean_implements('test')); //test with invalid value
$this->assertEquals(false, $tracker->bean_implements('ACL')); //test with valid value
}
public function testlogPage()
{
self::markTestIncomplete('Test parameters and local variables are not set');
//test without setting headerDisplayed
Tracker::logPage();
$this->assertEquals(null, $_SESSION['lpage']);
//test with headerDisplayed set
$GLOBALS['app']->headerDisplayed = 1;
Tracker::logPage();
$this->assertEquals(time(), $_SESSION['lpage']);
//$this->assertEquals(time(), null);
}
}