]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/modules/Notes/NotesTest.php
Added unit tests.
[Github/sugarcrm.git] / tests / modules / Notes / NotesTest.php
1 <?php
2 require_once "modules/Notes/Note.php";
3
4 class NotesTest extends Sugar_PHPUnit_Framework_TestCase
5 {
6     public function setUp()
7     {
8         $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
9         }
10
11     public function tearDown()
12     {
13         SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
14         unset($GLOBALS['current_user']);
15     }
16     
17     /**
18      * @group bug19499
19      */
20     public function testCreateProperNameFieldContainsFirstAndLastName()
21     {
22         require_once("modules/Contacts/Contact.php");
23         $contact = new Contact();
24         $contact->first_name = "Josh";
25         $contact->last_name = "Chi";
26         $contact->salutation = "Mr";
27         $contact->title = 'VP Operations';
28         $contact->disable_row_level_security = true;
29         $contact_id = $contact->save();
30         
31         $note = new Note();
32         $note->contact_id = $contact_id;
33         $note->disable_row_level_security = true;
34         $note->fill_in_additional_detail_fields();
35         
36         $this->assertContains($contact->first_name,$note->contact_name);
37         $this->assertContains($contact->last_name,$note->contact_name);
38         
39         $GLOBALS['db']->query('DELETE FROM contacts WHERE id =\''.$contact_id.'\'');
40     }
41 }