From: eileen Date: Tue, 5 Jul 2016 23:04:47 +0000 (+1200) Subject: [NFC] CRM-19033 improve standardisation of tests X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f2040bc69ff64d2d34aacf399e8ea095f26ad4e6;p=civicrm-core.git [NFC] CRM-19033 improve standardisation of tests NB jenkins is doing wierd things here so trying a small subset to see what jenkins does --- diff --git a/tests/phpunit/CRM/Activity/BAO/ActivityTest.php b/tests/phpunit/CRM/Activity/BAO/ActivityTest.php index 8643953b3f..bc7e1776fa 100644 --- a/tests/phpunit/CRM/Activity/BAO/ActivityTest.php +++ b/tests/phpunit/CRM/Activity/BAO/ActivityTest.php @@ -1,7 +1,5 @@ _testTimestamps(array( 'INSERT' => function ($contactId) use ($test, $customGroup, $customField) { - $result = civicrm_api3('contact', 'create', array( + civicrm_api3('contact', 'create', array( 'contact_id' => $contactId, 'custom_' . $customField['id'] => 'test-1', )); @@ -1524,8 +1524,7 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { ); }, )); - - Custom::deleteGroup($customGroup); + $this->quickCleanup(array('civicrm_contact'), TRUE); } /** @@ -1539,7 +1538,7 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { */ public function _testTimestamps($callbacks) { CRM_Core_DAO::triggerRebuild(); - $contactId = Contact::createIndividual(); + $contactId = $this->individualCreate(); $origTimestamps = CRM_Contact_BAO_Contact::getTimestamps($contactId); $this->assertRegexp('/^\d\d\d\d-\d\d-\d\d /', $origTimestamps['created_date']); diff --git a/tests/phpunit/CRM/Contact/BAO/ContactType/ContactSearchTest.php b/tests/phpunit/CRM/Contact/BAO/ContactType/ContactSearchTest.php index 659de1d687..978d0376f3 100644 --- a/tests/phpunit/CRM/Contact/BAO/ContactType/ContactSearchTest.php +++ b/tests/phpunit/CRM/Contact/BAO/ContactType/ContactSearchTest.php @@ -18,7 +18,7 @@ class CRM_Contact_BAO_ContactType_ContactSearchTest extends CiviUnitTestCase { 'parent_id' => 1, 'is_active' => 1, ); - $result = CRM_Contact_BAO_ContactType::add($params); + CRM_Contact_BAO_ContactType::add($params); $this->student = $params['name']; $parents = 'indivi_parent' . substr(sha1(rand()), 0, 7); @@ -29,7 +29,7 @@ class CRM_Contact_BAO_ContactType_ContactSearchTest extends CiviUnitTestCase { 'parent_id' => 1, 'is_active' => 1, ); - $result = CRM_Contact_BAO_ContactType::add($params); + CRM_Contact_BAO_ContactType::add($params); $this->parent = $params['name']; $orgs = 'org_sponsor' . substr(sha1(rand()), 0, 7); @@ -40,7 +40,7 @@ class CRM_Contact_BAO_ContactType_ContactSearchTest extends CiviUnitTestCase { 'parent_id' => 3, 'is_active' => 1, ); - $result = CRM_Contact_BAO_ContactType::add($params); + CRM_Contact_BAO_ContactType::add($params); $this->sponsor = $params['name']; $this->indiviParams = array( @@ -48,15 +48,15 @@ class CRM_Contact_BAO_ContactType_ContactSearchTest extends CiviUnitTestCase { 'last_name' => 'Grant', 'contact_type' => 'Individual', ); - $this->individual = Contact::create($this->indiviParams); + $this->individual = $this->individualCreate($this->indiviParams); - $this->indiviStudentParams = array( + $this->individualStudentParams = array( 'first_name' => 'Bill', 'last_name' => 'Adams', 'contact_type' => 'Individual', 'contact_sub_type' => $this->student, ); - $this->indiviStudent = Contact::create($this->indiviStudentParams); + $this->individualStudent = $this->individualCreate($this->individualStudentParams); $this->indiviParentParams = array( 'first_name' => 'Alen', @@ -64,26 +64,26 @@ class CRM_Contact_BAO_ContactType_ContactSearchTest extends CiviUnitTestCase { 'contact_type' => 'Individual', 'contact_sub_type' => $this->parent, ); - $this->indiviParent = Contact::create($this->indiviParentParams); + $this->indiviParent = $this->individualCreate($this->indiviParentParams); $this->organizationParams = array( 'organization_name' => 'Compumentor', 'contact_type' => 'Organization', ); - $this->organization = Contact::create($this->organizationParams); + $this->organization = $this->organizationCreate($this->organizationParams); $this->orgSponsorParams = array( 'organization_name' => 'Conservation Corp', 'contact_type' => 'Organization', 'contact_sub_type' => $this->sponsor, ); - $this->orgSponsor = Contact::create($this->orgSponsorParams); + $this->orgSponsor = $this->organizationCreate($this->orgSponsorParams); $this->householdParams = array( 'household_name' => "John Doe's home", 'contact_type' => 'Household', ); - $this->household = Contact::create($this->householdParams); + $this->household = $this->householdCreate($this->householdParams); } /** @@ -98,7 +98,7 @@ class CRM_Contact_BAO_ContactType_ContactSearchTest extends CiviUnitTestCase { $result = civicrm_api('contact', 'get', $params); $individual = $result['values'][$this->individual]; - $indiviStudent = $result['values'][$this->indiviStudent]; + $individualStudent = $result['values'][$this->individualStudent]; $indiviParent = $result['values'][$this->indiviParent]; //asserts for type:Individual @@ -108,10 +108,10 @@ class CRM_Contact_BAO_ContactType_ContactSearchTest extends CiviUnitTestCase { $this->assertNotContains('contact_sub_type', $individual); //asserts for type:Individual subtype:Student - $this->assertEquals($indiviStudent['contact_id'], $this->indiviStudent); - $this->assertEquals($indiviStudent['first_name'], $this->indiviStudentParams['first_name']); - $this->assertEquals($indiviStudent['contact_type'], $this->indiviStudentParams['contact_type']); - $this->assertEquals(end($indiviStudent['contact_sub_type']), $this->indiviStudentParams['contact_sub_type']); + $this->assertEquals($individualStudent['contact_id'], $this->individualStudent); + $this->assertEquals($individualStudent['first_name'], $this->individualStudentParams['first_name']); + $this->assertEquals($individualStudent['contact_type'], $this->individualStudentParams['contact_type']); + $this->assertEquals(end($individualStudent['contact_sub_type']), $this->individualStudentParams['contact_sub_type']); //asserts for type:Individual subtype:Parent $this->assertEquals($indiviParent['contact_id'], $this->indiviParent); @@ -162,13 +162,13 @@ class CRM_Contact_BAO_ContactType_ContactSearchTest extends CiviUnitTestCase { $params = array('contact_sub_type' => $this->student, 'version' => 3); $result = civicrm_api('contact', 'get', $params); - $indiviStudent = $result['values'][$this->indiviStudent]; + $individualStudent = $result['values'][$this->individualStudent]; //asserts for type:Individual subtype:Student - $this->assertEquals($indiviStudent['contact_id'], $this->indiviStudent); - $this->assertEquals($indiviStudent['first_name'], $this->indiviStudentParams['first_name']); - $this->assertEquals($indiviStudent['contact_type'], $this->indiviStudentParams['contact_type']); - $this->assertEquals(end($indiviStudent['contact_sub_type']), $this->indiviStudentParams['contact_sub_type']); + $this->assertEquals($individualStudent['contact_id'], $this->individualStudent); + $this->assertEquals($individualStudent['first_name'], $this->individualStudentParams['first_name']); + $this->assertEquals($individualStudent['contact_type'], $this->individualStudentParams['contact_type']); + $this->assertEquals(end($individualStudent['contact_sub_type']), $this->individualStudentParams['contact_sub_type']); //all other contact(rather than subtype:student) should not //exists @@ -193,7 +193,7 @@ class CRM_Contact_BAO_ContactType_ContactSearchTest extends CiviUnitTestCase { //all other contact(rather than subtype:Sponsor) should not //exists $this->assertNotContains($this->individual, $result['values']); - $this->assertNotContains($this->indiviStudent, $result['values']); + $this->assertNotContains($this->individualStudent, $result['values']); $this->assertNotContains($this->indiviParent, $result['values']); $this->assertNotContains($this->organization, $result['values']); $this->assertNotContains($this->household, $result['values']); @@ -210,13 +210,13 @@ class CRM_Contact_BAO_ContactType_ContactSearchTest extends CiviUnitTestCase { $params = array('contact_sub_type' => $this->student, 'version' => 3); $result = civicrm_api('contact', 'get', $params); - $indiviStudent = $result['values'][$this->indiviStudent]; + $individualStudent = $result['values'][$this->individualStudent]; //asserts for type:Individual subtype:Student - $this->assertEquals($indiviStudent['contact_id'], $this->indiviStudent); - $this->assertEquals($indiviStudent['first_name'], $this->indiviStudentParams['first_name']); - $this->assertEquals($indiviStudent['contact_type'], $this->indiviStudentParams['contact_type']); - $this->assertEquals(end($indiviStudent['contact_sub_type']), $this->indiviStudentParams['contact_sub_type']); + $this->assertEquals($individualStudent['contact_id'], $this->individualStudent); + $this->assertEquals($individualStudent['first_name'], $this->individualStudentParams['first_name']); + $this->assertEquals($individualStudent['contact_type'], $this->individualStudentParams['contact_type']); + $this->assertEquals(end($individualStudent['contact_sub_type']), $this->individualStudentParams['contact_sub_type']); //all other contact(rather than subtype:student) should not //exists @@ -241,7 +241,7 @@ class CRM_Contact_BAO_ContactType_ContactSearchTest extends CiviUnitTestCase { //all other contact(rather than subtype:Sponsor) should not //exists $this->assertNotContains($this->individual, $result['values']); - $this->assertNotContains($this->indiviStudent, $result['values']); + $this->assertNotContains($this->individualStudent, $result['values']); $this->assertNotContains($this->indiviParent, $result['values']); $this->assertNotContains($this->organization, $result['values']); $this->assertNotContains($this->household, $result['values']); diff --git a/tests/phpunit/CRM/Contact/BAO/ContactType/RelationshipTest.php b/tests/phpunit/CRM/Contact/BAO/ContactType/RelationshipTest.php index 827898e2e8..fad3f9982d 100644 --- a/tests/phpunit/CRM/Contact/BAO/ContactType/RelationshipTest.php +++ b/tests/phpunit/CRM/Contact/BAO/ContactType/RelationshipTest.php @@ -48,7 +48,7 @@ class CRM_Contact_BAO_ContactType_RelationshipTest extends CiviUnitTestCase { 'last_name' => 'Grant', 'contact_type' => 'Individual', ); - $this->individual = Contact::create($params); + $this->individual = $this->individualCreate($params); $params = array( 'first_name' => 'Bill', @@ -56,7 +56,7 @@ class CRM_Contact_BAO_ContactType_RelationshipTest extends CiviUnitTestCase { 'contact_type' => 'Individual', 'contact_sub_type' => $this->student, ); - $this->indivi_student = Contact::create($params); + $this->indivi_student = $this->individualCreate($params); $params = array( 'first_name' => 'Alen', @@ -64,20 +64,20 @@ class CRM_Contact_BAO_ContactType_RelationshipTest extends CiviUnitTestCase { 'contact_type' => 'Individual', 'contact_sub_type' => $this->parent, ); - $this->indivi_parent = Contact::create($params); + $this->indivi_parent = $this->individualCreate($params); $params = array( 'organization_name' => 'Compumentor', 'contact_type' => 'Organization', ); - $this->organization = Contact::create($params); + $this->organization = $this->organizationCreate($params); $params = array( 'organization_name' => 'Conservation Corp', 'contact_type' => 'Organization', 'contact_sub_type' => $this->sponsor, ); - $this->organization_sponsor = Contact::create($params); + $this->organization_sponsor = $this->organizationCreate($params); } public function tearDown() { diff --git a/tests/phpunit/CRM/Contact/BAO/GroupContactTest.php b/tests/phpunit/CRM/Contact/BAO/GroupContactTest.php index 719948faeb..3e624ac3e2 100644 --- a/tests/phpunit/CRM/Contact/BAO/GroupContactTest.php +++ b/tests/phpunit/CRM/Contact/BAO/GroupContactTest.php @@ -122,7 +122,7 @@ class CRM_Contact_BAO_GroupContactTest extends CiviUnitTestCase { 'last_name' => 'Parent1 Lname', 'group' => array($parentGroup->id => 1), ); - $parentContact = Contact::createIndividual($parentContactParams); + $parentContact = $this->individualCreate($parentContactParams); // create a contact within child dgroup $childContactParams = array( @@ -130,7 +130,7 @@ class CRM_Contact_BAO_GroupContactTest extends CiviUnitTestCase { 'last_name' => 'Child2 Lname', 'group' => array($childGroup->id => 1), ); - $childContact = Contact::createIndividual($childContactParams); + $childContact = $this->individualCreate($childContactParams); // Check if searching by parent group returns both parent and child group contacts $searchParams = array( diff --git a/tests/phpunit/CRM/Contribute/BAO/ContributionPageTest.php b/tests/phpunit/CRM/Contribute/BAO/ContributionPageTest.php index e7e822c8d2..7c85355c24 100644 --- a/tests/phpunit/CRM/Contribute/BAO/ContributionPageTest.php +++ b/tests/phpunit/CRM/Contribute/BAO/ContributionPageTest.php @@ -72,7 +72,7 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase { $this->assertNotNull($contributionpage->id); $this->assertType('int', $contributionpage->id); - ContributionPage::delete($contributionpage->id); + $this->callAPISuccess('ContributionPage', 'delete', array('id' => $contributionpage->id)); } /** @@ -91,7 +91,7 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase { $is_active = 1; $pageActive = CRM_Contribute_BAO_ContributionPage::setIsActive($id, $is_active); $this->assertEquals($pageActive, TRUE, 'Verify financial types record deletion.'); - ContributionPage::delete($contributionpage->id); + $this->callAPISuccess('ContributionPage', 'delete', array('id' => $contributionpage->id)); } /** @@ -114,7 +114,7 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase { $this->assertEquals($params['title'], $values['title'], 'Verify contribution title.'); $this->assertEquals($this->_financialTypeID, $values['financial_type_id'], 'Verify financial types id.'); $this->assertEquals(1, $values['is_active'], 'Verify contribution is_active value.'); - ContributionPage::delete($contributionpage->id); + $this->callAPISuccess('ContributionPage', 'delete', array('id' => $contributionpage->id)); } /** @@ -144,8 +144,8 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase { $copycontributionpage = CRM_Contribute_BAO_ContributionPage::copy($contributionpage->id); $this->assertEquals($copycontributionpage->financial_type_id, $this->_financialTypeID, 'Check for Financial type id.'); $this->assertEquals($copycontributionpage->goal_amount, 400, 'Check for goal amount.'); - ContributionPage::delete($contributionpage->id); - ContributionPage::delete($copycontributionpage->id); + $this->callAPISuccess('ContributionPage', 'delete', array('id' => $contributionpage->id)); + $this->callAPISuccess('ContributionPage', 'delete', array('id' => $copycontributionpage->id)); } } diff --git a/tests/phpunit/CRM/Core/BAO/AddressTest.php b/tests/phpunit/CRM/Core/BAO/AddressTest.php index e16dbafbeb..9cf3cc8800 100644 --- a/tests/phpunit/CRM/Core/BAO/AddressTest.php +++ b/tests/phpunit/CRM/Core/BAO/AddressTest.php @@ -40,7 +40,7 @@ class CRM_Core_BAO_AddressTest extends CiviUnitTestCase { * Create() method (create and update modes) */ public function testCreate() { - $contactId = Contact::createIndividual(); + $contactId = $this->individualCreate(); $params = array(); $params['address']['1'] = array( @@ -102,7 +102,7 @@ class CRM_Core_BAO_AddressTest extends CiviUnitTestCase { * Add() method ( ) */ public function testAdd() { - $contactId = Contact::createIndividual(); + $contactId = $this->individualCreate(); $fixParams = array( 'street_address' => 'E 906N Pine Pl W', @@ -141,7 +141,7 @@ class CRM_Core_BAO_AddressTest extends CiviUnitTestCase { * AllAddress() method ( ) */ public function testallAddress() { - $contactId = Contact::createIndividual(); + $contactId = $this->individualCreate(); $fixParams = array( 'street_address' => 'E 906N Pine Pl W', @@ -199,7 +199,7 @@ class CRM_Core_BAO_AddressTest extends CiviUnitTestCase { * AllAddress() method ( ) with null value */ public function testnullallAddress() { - $contactId = Contact::createIndividual(); + $contactId = $this->individualCreate(); $fixParams = array( 'street_address' => 'E 906N Pine Pl W', @@ -237,7 +237,7 @@ class CRM_Core_BAO_AddressTest extends CiviUnitTestCase { * GetValues() method (get Address fields) */ public function testGetValues() { - $contactId = Contact::createIndividual(); + $contactId = $this->individualCreate(); $params = array(); $params['address']['1'] = array( diff --git a/tests/phpunit/CRM/Core/BAO/CustomFieldTest.php b/tests/phpunit/CRM/Core/BAO/CustomFieldTest.php index 2e83aecfc3..015bff2dd0 100644 --- a/tests/phpunit/CRM/Core/BAO/CustomFieldTest.php +++ b/tests/phpunit/CRM/Core/BAO/CustomFieldTest.php @@ -257,20 +257,20 @@ class CRM_Core_BAO_CustomFieldTest extends CiviUnitTestCase { )), ); $contacts = array( - 'alice' => Contact::createIndividual(array( + 'alice' => $this->individualCreate(array( 'first_name' => 'Alice', 'last_name' => 'Albertson', 'custom_' . $fields['countryA']->id => $countriesByName['ANDORRA'], 'custom_' . $fields['countryB']->id => $countriesByName['BARBADOS'], )), - 'bob' => Contact::createIndividual(array( + 'bob' => $this->individualCreate(array( 'first_name' => 'Bob', 'last_name' => 'Roberts', 'custom_' . $fields['countryA']->id => $countriesByName['AUSTRIA'], 'custom_' . $fields['countryB']->id => $countriesByName['BERMUDA'], 'custom_' . $fields['countryC']->id => $countriesByName['CHAD'], )), - 'carol' => Contact::createIndividual(array( + 'carol' => $this->individualCreate(array( 'first_name' => 'Carol', 'last_name' => 'Carolson', 'custom_' . $fields['countryC']->id => $countriesByName['CAMBODIA'], diff --git a/tests/phpunit/CRM/Core/BAO/CustomGroupTest.php b/tests/phpunit/CRM/Core/BAO/CustomGroupTest.php index 30de68a896..aeadf78e5a 100644 --- a/tests/phpunit/CRM/Core/BAO/CustomGroupTest.php +++ b/tests/phpunit/CRM/Core/BAO/CustomGroupTest.php @@ -480,13 +480,13 @@ class CRM_Core_BAO_CustomGroupTest extends CiviUnitTestCase { * Test getActiveGroups() with Invalid Params() */ public function testGetActiveGroupsWithInvalidParams() { - $contactId = Contact::createIndividual(); + $contactId = $this->individualCreate(); $activeGroups = CRM_Core_BAO_CustomGroup::getActiveGroups('ABC', 'civicrm/contact/view/cd', $contactId); $this->assertEquals(empty($activeGroups), TRUE, 'Check that Emprt params are retreived'); } public function testGetActiveGroups() { - $contactId = Contact::createIndividual(); + $contactId = $this->individualCreate(); $customGrouptitle = 'Test Custom Group'; $groupParams = array( 'title' => $customGrouptitle, diff --git a/tests/phpunit/CRM/Core/BAO/CustomValueTableMultipleTest.php b/tests/phpunit/CRM/Core/BAO/CustomValueTableMultipleTest.php index 9b17c612bf..f00f5836be 100644 --- a/tests/phpunit/CRM/Core/BAO/CustomValueTableMultipleTest.php +++ b/tests/phpunit/CRM/Core/BAO/CustomValueTableMultipleTest.php @@ -12,7 +12,7 @@ class CRM_Core_BAO_CustomValueTableMultipleTest extends CiviUnitTestCase { public function testCustomGroupMultipleSingle() { $params = array(); - $contactID = Contact::createIndividual(); + $contactID = $this->individualCreate(); $customGroup = Custom::createGroup($params, 'Individual', TRUE); $fields = array( 'groupId' => $customGroup->id, @@ -43,7 +43,7 @@ class CRM_Core_BAO_CustomValueTableMultipleTest extends CiviUnitTestCase { public function testCustomGroupMultipleDouble() { $params = array(); - $contactID = Contact::createIndividual(); + $contactID = $this->individualCreate(); $customGroup = Custom::createGroup($params, 'Individual', TRUE); $fields = array( 'groupId' => $customGroup->id, @@ -76,7 +76,7 @@ class CRM_Core_BAO_CustomValueTableMultipleTest extends CiviUnitTestCase { public function testCustomGroupMultipleUpdate() { $params = array(); - $contactID = Contact::createIndividual(); + $contactID = $this->individualCreate(); $customGroup = Custom::createGroup($params, 'Individual', TRUE); $fields = array( 'groupId' => $customGroup->id, @@ -118,7 +118,7 @@ class CRM_Core_BAO_CustomValueTableMultipleTest extends CiviUnitTestCase { public function testCustomGroupMultipleOldFormate() { $params = array(); - $contactID = Contact::createIndividual(); + $contactID = $this->individualCreate(); $customGroup = Custom::createGroup($params, 'Individual', TRUE); $fields = array( 'groupId' => $customGroup->id, diff --git a/tests/phpunit/CRM/Core/BAO/CustomValueTableSetGetTest.php b/tests/phpunit/CRM/Core/BAO/CustomValueTableSetGetTest.php index e633279f9a..2759866242 100644 --- a/tests/phpunit/CRM/Core/BAO/CustomValueTableSetGetTest.php +++ b/tests/phpunit/CRM/Core/BAO/CustomValueTableSetGetTest.php @@ -15,7 +15,7 @@ class CRM_Core_BAO_CustomValueTableSetGetTest extends CiviUnitTestCase { */ public function testSetGetValuesDate() { $params = array(); - $contactID = Contact::createIndividual(); + $contactID = $this->individualCreate(); //create Custom Group $customGroup = Custom::createGroup($params, 'Individual', TRUE); @@ -114,7 +114,7 @@ class CRM_Core_BAO_CustomValueTableSetGetTest extends CiviUnitTestCase { */ public function testSetGetValuesYesNoRadio() { $params = array(); - $contactID = Contact::createIndividual(); + $contactID = $this->individualCreate(); //create Custom Group $customGroup = Custom::createGroup($params, 'Individual', TRUE); diff --git a/tests/phpunit/CRM/Core/BAO/CustomValueTableTest.php b/tests/phpunit/CRM/Core/BAO/CustomValueTableTest.php index f8846716e5..86ec745ea2 100644 --- a/tests/phpunit/CRM/Core/BAO/CustomValueTableTest.php +++ b/tests/phpunit/CRM/Core/BAO/CustomValueTableTest.php @@ -16,7 +16,7 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase { */ public function testStoreCountry() { $params = array(); - $contactID = Contact::createIndividual(); + $contactID = $this->individualCreate(); $customGroup = Custom::createGroup($params, 'Individual'); $fields = array( 'groupId' => $customGroup->id, @@ -51,7 +51,7 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase { */ public function atestStoreFile() { $params = array(); - $contactID = Contact::createIndividual(); + $contactID = $this->individualCreate(); $customGroup = Custom::createGroup($params, 'Individual'); $fields = array( 'groupId' => $customGroup->id, @@ -86,7 +86,7 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase { */ public function testStoreStateProvince() { $params = array(); - $contactID = Contact::createIndividual(); + $contactID = $this->individualCreate(); $customGroup = Custom::createGroup($params, 'Individual'); $fields = array( 'groupId' => $customGroup->id, @@ -120,7 +120,7 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase { */ public function testStoreDate() { $params = array(); - $contactID = Contact::createIndividual(); + $contactID = $this->individualCreate(); $customGroup = Custom::createGroup($params, 'Individual'); $fields = array( 'groupId' => $customGroup->id, @@ -155,7 +155,7 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase { */ public function testStoreRichTextEditor() { $params = array(); - $contactID = Contact::createIndividual(); + $contactID = $this->individualCreate(); $customGroup = Custom::createGroup($params, 'Individual'); $fields = array( 'groupId' => $customGroup->id, @@ -191,7 +191,7 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase { public function testgetEntityValues() { $params = array(); - $contactID = Contact::createIndividual(); + $contactID = $this->individualCreate(); $customGroup = Custom::createGroup($params, 'Individual'); $fields = array( 'groupId' => $customGroup->id, @@ -228,7 +228,7 @@ class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase { public function testCustomGroupMultiple() { $params = array(); - $contactID = Contact::createIndividual(); + $contactID = $this->individualCreate(); $customGroup = Custom::createGroup($params, 'Individual'); $fields = array( diff --git a/tests/phpunit/CRM/Core/BAO/EmailTest.php b/tests/phpunit/CRM/Core/BAO/EmailTest.php index 4dbe37c5cd..f6d008b4c7 100644 --- a/tests/phpunit/CRM/Core/BAO/EmailTest.php +++ b/tests/phpunit/CRM/Core/BAO/EmailTest.php @@ -17,7 +17,7 @@ class CRM_Core_BAO_EmailTest extends CiviUnitTestCase { * Add() method (create and update modes) */ public function testAdd() { - $contactId = Contact::createIndividual(); + $contactId = $this->individualCreate(); $params = array(); $params = array( @@ -57,7 +57,7 @@ class CRM_Core_BAO_EmailTest extends CiviUnitTestCase { * HoldEmail() method (set and reset on_hold condition) */ public function testHoldEmail() { - $contactId = Contact::createIndividual(); + $contactId = $this->individualCreate(); $params = array( 'email' => 'jane.doe@example.com', @@ -132,12 +132,12 @@ class CRM_Core_BAO_EmailTest extends CiviUnitTestCase { $contactParams = array( 'first_name' => 'Alan', 'last_name' => 'Smith', - 'email-1' => 'alan.smith1@example.com', - 'email-2' => 'alan.smith2@example.com', - 'email-3' => 'alan.smith3@example.com', + 'email' => 'alan.smith1@example.com', + 'api.email.create.0' => array('email' => 'alan.smith2@example.com', 'location_type_id' => 'Home'), + 'api.email.create.1' => array('email' => 'alan.smith3@example.com', 'location_type_id' => 'Main'), ); - $contactId = Contact::createIndividual($contactParams); + $contactId = $this->individualCreate($contactParams); $emails = CRM_Core_BAO_Email::allEmails($contactId); diff --git a/tests/phpunit/CRM/Core/BAO/IMTest.php b/tests/phpunit/CRM/Core/BAO/IMTest.php index d9797ff1a4..c1420a9e9f 100644 --- a/tests/phpunit/CRM/Core/BAO/IMTest.php +++ b/tests/phpunit/CRM/Core/BAO/IMTest.php @@ -13,7 +13,7 @@ class CRM_Core_BAO_IMTest extends CiviUnitTestCase { * Add() method (create and update modes) */ public function testAdd() { - $contactId = Contact::createIndividual(); + $contactId = $this->individualCreate(); $params = array(); $params = array( diff --git a/tests/phpunit/CRM/Core/BAO/LocationTest.php b/tests/phpunit/CRM/Core/BAO/LocationTest.php index 3d6d037e2f..2b541ae476 100644 --- a/tests/phpunit/CRM/Core/BAO/LocationTest.php +++ b/tests/phpunit/CRM/Core/BAO/LocationTest.php @@ -65,7 +65,7 @@ class CRM_Core_BAO_LocationTest extends CiviUnitTestCase { } public function testCreateWithMissingParams() { - $contactId = Contact::createIndividual(); + $contactId = $this->individualCreate(); $params = array( 'contact_id' => $contactId, 'street_address' => 'Saint Helier St', @@ -87,7 +87,7 @@ class CRM_Core_BAO_LocationTest extends CiviUnitTestCase { * without civicrm_loc_block entry */ public function testCreateWithoutLocBlock() { - $contactId = Contact::createIndividual(); + $contactId = $this->individualCreate(); //create various element of location block //like address, phone, email, openid, im.