From 59cacb3452cbf42a42f0a7e32290793d371aa6dc Mon Sep 17 00:00:00 2001 From: Anthony Nemirovsky Date: Fri, 25 Apr 2014 15:17:17 -0700 Subject: [PATCH] Revert "Fix the retrieveContact test fail on asserting relatiotionship for current" This reverts commit 900c5b9c341b8f5eeb346941da4ec891b02bb417. --- tests/phpunit/CRM/Contact/BAO/ContactTest.php | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/tests/phpunit/CRM/Contact/BAO/ContactTest.php b/tests/phpunit/CRM/Contact/BAO/ContactTest.php index 5e90eef844..99f79ecbb0 100644 --- a/tests/phpunit/CRM/Contact/BAO/ContactTest.php +++ b/tests/phpunit/CRM/Contact/BAO/ContactTest.php @@ -546,22 +546,16 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { //take the common contact params $params = $this->contactParams(); $params['note'] = 'test note'; + $params['create_employer'] = 1; //create the contact with given params. $contact = CRM_Contact_BAO_Contact::create($params); //Now check $contact is object of contact DAO.. $this->assertInstanceOf('CRM_Contact_DAO_Contact', $contact, 'Check for created object'); $contactId = $contact->id; - //create the organization contact with the given params. - $orgParams = array( - 'organization_name' => 'Test Organization', - 'contact_type' => 'Organization', - ); - $orgContact = CRM_Contact_BAO_Contact::add($orgParams); - $this->assertInstanceOf('CRM_Contact_DAO_Contact', $orgContact, 'Check for created object'); //create employee of relationship. - CRM_Contact_BAO_Contact_Utils::createCurrentEmployerRelationship($contactId, $orgContact->id); + CRM_Contact_BAO_Contact_Utils::createCurrentEmployerRelationship($contactId, $params['create_employer']); //retrieve the contact values from database. $values = array(); @@ -580,9 +574,8 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { $this->assertEquals($params['contact_type'], $values['contact_type'], 'Check for contact type creation.'); //Now check values of address - $this->assertAttributesEquals(CRM_Utils_Array::value('1', $params['address']), - CRM_Utils_Array::value('1', $values['address']) - ); + // $this->assertAttributesEquals( CRM_Utils_Array::value( 'address', $params ), + // CRM_Utils_Array::value( 'address', $values ) ); //Now check values of email $this->assertAttributesEquals(CRM_Utils_Array::value('1', $params['email']), @@ -622,11 +615,11 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { $this->assertEquals(1, $values['relationship']['totalCount'], 'Check for total relationship count'); foreach ($values['relationship']['data'] as $key => $val) { //Now check values of Relationship organization. - $this->assertEquals($orgContact->id, $val['contact_id_b'], 'Check for organization'); + $this->assertEquals($params['create_employer'], $val['id'], 'Check for organization'); //Now check values of Relationship type. $this->assertEquals('Employee of', $val['relation'], 'Check for relationship type'); //delete the organization. - Contact::delete(CRM_Utils_Array::value('contact_id_b', $val)); + Contact::delete(CRM_Utils_Array::value('cid', $val)); } //delete all notes related to contact -- 2.25.1