From ffdc26b86f8821db7640dc8f864353c61d3e7e60 Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 11 Sep 2020 20:59:09 +1200 Subject: [PATCH] dev/core#2017 Remove unused function OpenID::isAllowedToLogin --- CRM/Core/BAO/OpenID.php | 17 --------- tests/phpunit/CRM/Core/BAO/OpenIDTest.php | 45 ----------------------- 2 files changed, 62 deletions(-) diff --git a/CRM/Core/BAO/OpenID.php b/CRM/Core/BAO/OpenID.php index 34326a7562..365b600603 100644 --- a/CRM/Core/BAO/OpenID.php +++ b/CRM/Core/BAO/OpenID.php @@ -43,23 +43,6 @@ class CRM_Core_BAO_OpenID extends CRM_Core_DAO_OpenID { return CRM_Core_BAO_Block::getValues('openid', $entityBlock); } - /** - * Returns whether or not this OpenID is allowed to login. - * - * @param string $identity_url - * The OpenID to check. - * - * @return bool - */ - public static function isAllowedToLogin($identity_url) { - $openId = new CRM_Core_DAO_OpenID(); - $openId->openid = $identity_url; - if ($openId->find(TRUE)) { - return $openId->allowed_to_login == 1; - } - return FALSE; - } - /** * Get all the openids for a specified contact_id, with the primary openid being first * diff --git a/tests/phpunit/CRM/Core/BAO/OpenIDTest.php b/tests/phpunit/CRM/Core/BAO/OpenIDTest.php index 1d0886b5c4..0e44466358 100644 --- a/tests/phpunit/CRM/Core/BAO/OpenIDTest.php +++ b/tests/phpunit/CRM/Core/BAO/OpenIDTest.php @@ -62,51 +62,6 @@ class CRM_Core_BAO_OpenIDTest extends CiviUnitTestCase { $this->assertDBRowNotExist('CRM_Contact_DAO_Contact', $contactId); } - /** - * IfAllowedToLogin() method (set and reset allowed_to_login) - */ - public function testIfAllowedToLogin() { - $contactId = $this->individualCreate(); - $this->assertDBRowExist('CRM_Contact_DAO_Contact', $contactId); - $openIdURL = "http://test-username.civicrm.org/"; - - $params = [ - 'contact_id' => $contactId, - 'location_type_id' => 1, - 'openid' => $openIdURL, - 'is_primary' => 1, - ]; - - $openObject = CRM_Core_BAO_OpenID::add($params); - - $openId = $openObject->id; - $this->assertDBNotNull('CRM_Core_DAO_OpenID', $openIdURL, 'id', 'openid', - 'Database check for created OpenID.' - ); - - $allowedToLogin = CRM_Core_BAO_OpenID::isAllowedToLogin($openIdURL); - $this->assertEquals($allowedToLogin, FALSE, 'Verify allowed_to_login value is 0.'); - - // Now call add() to modify an existing open-id record - - $params = [ - 'id' => $openId, - 'contact_id' => $contactId, - 'openid' => $openIdURL, - 'is_bulkmail' => 1, - 'allowed_to_login' => 1, - ]; - - CRM_Core_BAO_OpenID::add($params); - - $allowedToLogin = CRM_Core_BAO_OpenID::isAllowedToLogin($openIdURL); - - $this->assertEquals($allowedToLogin, TRUE, 'Verify allowed_to_login value is 1.'); - $this->contactDelete($contactId); - //domain contact doesn't really get deleted // - $this->assertDBRowNotExist('CRM_Contact_DAO_Contact', $contactId); - } - /** * AllOpenIDs() method - get all OpenIDs for the given contact */ -- 2.25.1