]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/include/vCard/vCardBug40629Test.php
Added unit tests.
[Github/sugarcrm.git] / tests / include / vCard / vCardBug40629Test.php
1 <?php
2 require_once 'include/vCard.php';
3
4 class vCardBug40629Test extends Sugar_PHPUnit_Framework_TestCase
5 {
6     protected $account;
7     
8     public function setUp()
9     {
10         $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
11         $this->account = SugarTestAccountUtilities::createAccount();
12         $this->account->name = "SDizzle Inc";
13         $this->account->save();
14     }
15     
16     public function tearDown()
17     {
18         unset($GLOBALS['current_user']);
19         SugarTestAccountUtilities::removeAllCreatedAccounts();
20     }
21     
22     /**
23      * @group bug40629
24      */
25         public function testImportedVcardAccountLink()
26     {
27         $filename  = dirname(__FILE__)."/SimpleVCard.vcf";
28         
29         $vcard = new vCard();
30         $contact_id = $vcard->importVCard($filename,'Contacts');
31         $contact_record = new Contact();
32         $contact_record->retrieve($contact_id);
33         
34         $this->assertFalse(empty($contact_record->account_id), "Contact should have an account record associated");
35         $GLOBALS['db']->query("delete from contacts where id = '{$contact_id}'");
36         
37         $vcard = new vCard();
38         $lead_id = $vcard->importVCard($filename,'Leads');
39         $lead_record = new Lead();
40         $lead_record->retrieve($lead_id);
41         
42         $this->assertTrue(empty($lead_record->account_id), "Lead should not have an account record associated");
43         $GLOBALS['db']->query("delete from leads where id = '{$lead_id}'");
44     }
45 }