From 0a81c1832a4bb34921cf7d7dafc586ad40b2c0a0 Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 10 Sep 2020 09:48:59 +1200 Subject: [PATCH] Remove CRM_Contact_BAO_Contact::getPrimaryOpenId It seems it's only ever called from aa test now --- CRM/Contact/BAO/Contact.php | 27 ------------------- tests/phpunit/CRM/Contact/BAO/ContactTest.php | 24 ----------------- 2 files changed, 51 deletions(-) diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index a0e84b6b6d..138b9569bb 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -2568,33 +2568,6 @@ LEFT JOIN civicrm_email ON ( civicrm_contact.id = civicrm_email.contact_id ) return $email; } - /** - * Function to get primary OpenID of the contact. - * - * @param int $contactID - * Contact id. - * - * @return string - * >openid OpenID if present else null - */ - public static function getPrimaryOpenId($contactID) { - // fetch the primary OpenID - $query = " -SELECT civicrm_openid.openid as openid -FROM civicrm_contact -LEFT JOIN civicrm_openid ON ( civicrm_contact.id = civicrm_openid.contact_id ) -WHERE civicrm_contact.id = %1 -AND civicrm_openid.is_primary = 1"; - $p = [1 => [$contactID, 'Integer']]; - $dao = CRM_Core_DAO::executeQuery($query, $p); - - $openId = NULL; - if ($dao->fetch()) { - $openId = $dao->openid; - } - return $openId; - } - /** * Fetch the object and store the values in the values array. * diff --git a/tests/phpunit/CRM/Contact/BAO/ContactTest.php b/tests/phpunit/CRM/Contact/BAO/ContactTest.php index a4948fcf47..8c6e925b06 100644 --- a/tests/phpunit/CRM/Contact/BAO/ContactTest.php +++ b/tests/phpunit/CRM/Contact/BAO/ContactTest.php @@ -1186,30 +1186,6 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { $this->quickCleanup(['civicrm_contact']); } - /** - * Test case for getPrimaryOpenId( ). - */ - public function testGetPrimaryOpenId() { - //get the contact params - $params = $this->contactParams(); - $params['openid'][2] = $params['openid'][1]; - $params['openid'][2]['location_type_id'] = 2; - $params['openid'][2]['openid'] = 'http://primaryopenid.org/'; - unset($params['openid'][1]['is_primary']); - - //create contact - $contact = CRM_Contact_BAO_Contact::create($params); - $contactId = $contact->id; - //get the primary openid - $openID = CRM_Contact_BAO_Contact::getPrimaryOpenId($contactId); - - //Now check the primary openid - $this->assertEquals($openID, strtolower($params['openid'][2]['openid']), 'Check Primary OpenID'); - - //cleanup DB by deleting the contact - $this->contactDelete($contactId); - } - /** * Test case for matchContactOnEmail( ). */ -- 2.25.1