]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/modules/Contacts/Bug7825Test.php
Added unit tests.
[Github/sugarcrm.git] / tests / modules / Contacts / Bug7825Test.php
1 <?php 
2 require_once('include/SugarFields/Fields/Relate/SugarFieldRelate.php');
3
4 class Bug7825Test extends Sugar_PHPUnit_Framework_TestCase
5 {
6         public function testFormatFieldInSugarFieldRelate()
7         {
8                 global $current_user;   
9         $current_user = new User();
10         $current_user->retrieve('1');
11                 
12                 $current_user->setPreference('default_locale_name_format', 'l f s');
13             $sugar_field_relate = new SugarFieldRelate('Relate');
14                 $new_field = $sugar_field_relate->formatField('Max Liang', array('name' => 'contact_name'));
15                 
16                 $this->assertEquals(trim($new_field), trim('Liang Max'), "Assert that name format is correct");
17                 
18                 $current_user->setPreference('default_locale_name_format', 'f l s');
19             $sugar_field_relate = new SugarFieldRelate('Relate');
20                 $new_field = $sugar_field_relate->formatField('Max Liang', array('name' => 'contact_name'));
21                 
22                 $this->assertEquals(trim($new_field), trim('Max Liang'), "Assert that name format is correct");
23     }
24 }