2 require_once 'include/SugarObjects/templates/person/Person.php';
4 class PersonTemplateTest extends Sugar_PHPUnit_Framework_TestCase
9 public function setUp()
11 $this->_bean = new Person;
12 $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
15 public function tearDown()
18 unset($GLOBALS['current_user']);
19 SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
22 public function testNameIsReturnedAsSummaryText()
24 $GLOBALS['current_user']->setPreference('default_locale_name_format', 'l f');
26 $this->_bean->first_name = 'Test';
27 $this->_bean->last_name = 'Contact';
28 $this->_bean->title = '';
29 $this->_bean->salutation = '';
30 $this->assertEquals($this->_bean->get_summary_text(),'Contact Test');
36 public function testNameIsReturnedAsSummaryTextWhenSalutationIsInvalid()
38 $GLOBALS['current_user']->setPreference('default_locale_name_format', 's l f');
40 $this->_bean->salutation = 'Tester';
41 $this->_bean->first_name = 'Test';
42 $this->_bean->last_name = 'Contact';
43 $this->_bean->title = '';
44 $this->assertEquals($this->_bean->get_summary_text(),'Contact Test');