From 158d3e038cfdcb8ea4211e88e6cb57130512e5e0 Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 20 Aug 2013 17:15:40 +1200 Subject: [PATCH] CRM-13234 add test to lock in profile set as working --- tests/phpunit/api/v3/ProfileTest.php | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/phpunit/api/v3/ProfileTest.php b/tests/phpunit/api/v3/ProfileTest.php index c604189c49..61f3ef99b1 100644 --- a/tests/phpunit/api/v3/ProfileTest.php +++ b/tests/phpunit/api/v3/ProfileTest.php @@ -383,6 +383,41 @@ class api_v3_ProfileTest extends CiviUnitTestCase { } } + /** + * set is deprecated but we need to ensure it still works + */ + function testLegacySet() { + $pofileFieldValues = $this->_createIndividualContact(); + current($pofileFieldValues); + $contactId = key($pofileFieldValues); + + $updateParams = array( + 'first_name' => 'abc2', + 'last_name' => 'xyz2', + 'email-Primary' => 'abc2.xyz2@gmail.com', + 'phone-1-1' => '022 321 826', + 'country-1' => '1013', + 'state_province-1' => '1000', + ); + + $params = array_merge(array( + 'profile_id' => 25, + 'contact_id' => $contactId, + ), $updateParams); + + $result = $this->callAPISuccess('profile', 'set', $params); + $this->assertArrayKeyExists('values', $result); + $getParams = array( + 'profile_id' => 25, + 'contact_id' => $contactId, + ); + $profileDetails = $this->callAPISuccess('profile', 'get', $getParams); + + foreach ($updateParams as $profileField => $value) { + $this->assertEquals($value, CRM_Utils_Array::value($profileField, $profileDetails['values']), "In line " . __LINE__ . " error message: " . "missing/mismatching value for {$profileField}" + ); + } + } /* * check contact activity profile without activity id */ -- 2.25.1