From 3bafd4a90ad9018616bc6629a37de0392e4129df Mon Sep 17 00:00:00 2001 From: demeritcowboy Date: Sun, 26 Sep 2021 10:19:19 -0400 Subject: [PATCH] noisier --- CRM/Core/BAO/Setting.php | 6 ++-- tests/phpunit/CRM/Core/BAO/SettingTest.php | 34 ++++++---------------- 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/CRM/Core/BAO/Setting.php b/CRM/Core/BAO/Setting.php index 2329a21acb..e4c14859e0 100644 --- a/CRM/Core/BAO/Setting.php +++ b/CRM/Core/BAO/Setting.php @@ -75,13 +75,13 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { $manager = \Civi::service('settings_manager'); $settings = ($contactID === NULL) ? $manager->getBagByDomain($domainID) : $manager->getBagByContact($domainID, $contactID); if ($name === NULL) { - CRM_Core_Error::debug_log_message("Deprecated: Group='$group'. Name should be provided.\n"); + CRM_Core_Error::deprecatedWarning("Deprecated: Group='$group'. Name should be provided.\n"); } if ($componentID !== NULL) { - CRM_Core_Error::debug_log_message("Deprecated: Group='$group'. Name='$name'. Component should be omitted\n"); + CRM_Core_Error::deprecatedWarning("Deprecated: Group='$group'. Name='$name'. Component should be omitted\n"); } if ($defaultValue !== NULL) { - CRM_Core_Error::debug_log_message("Deprecated: Group='$group'. Name='$name'. Defaults should come from metadata\n"); + CRM_Core_Error::deprecatedWarning("Deprecated: Group='$group'. Name='$name'. Defaults should come from metadata\n"); } return $name ? $settings->get($name) : $settings->all(); } diff --git a/tests/phpunit/CRM/Core/BAO/SettingTest.php b/tests/phpunit/CRM/Core/BAO/SettingTest.php index 33162f5b5e..3aecff7247 100644 --- a/tests/phpunit/CRM/Core/BAO/SettingTest.php +++ b/tests/phpunit/CRM/Core/BAO/SettingTest.php @@ -121,41 +121,25 @@ class CRM_Core_BAO_SettingTest extends CiviUnitTestCase { global $civicrm_setting; $civicrm_setting[CRM_Core_BAO_Setting::DIRECTORY_PREFERENCES_NAME]['imageUploadDir'] = '/test/override'; Civi::service('settings_manager')->useMandatory(); - $value = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::DIRECTORY_PREFERENCES_NAME, 'imageUploadDir'); + $value = Civi::settings()->get('imageUploadDir'); $this->assertEquals('/test/override', $value); + $civicrm_setting['domain']['customCSSURL'] = 'http://test.test/overridedomain'; + Civi::service('settings_manager')->useMandatory(); + $value = Civi::settings()->get('customCSSURL'); + $this->assertEquals('http://test.test/overridedomain', $value); + // CRM-14974 test suite $civicrm_setting['Test Preferences']['overrideSetting'] = '/test/override'; Civi::service('settings_manager')->useMandatory(); - $values = CRM_Core_BAO_Setting::getItem('Test Preferences'); - $this->assertEquals('/test/override', $values['overrideSetting']); - Civi::settings()->set('databaseSetting', '/test/database'); - $values = CRM_Core_BAO_Setting::getItem('Test Preferences'); - $this->assertEquals('/test/override', $values['overrideSetting']); - $this->assertEquals('/test/database', $values['databaseSetting']); - $civicrm_setting['Test Preferences']['databaseSetting'] = '/test/dataride'; - Civi::service('settings_manager')->useMandatory(); - $values = CRM_Core_BAO_Setting::getItem('Test Preferences'); - $this->assertEquals('/test/override', $values['overrideSetting']); - $this->assertEquals('/test/dataride', $values['databaseSetting']); + $value = Civi::settings()->get('overrideSetting'); + $this->assertEquals('/test/override', $value); // CRM-14974 tear down unset($civicrm_setting['Test Preferences']); - $query = "DELETE FROM civicrm_setting WHERE name IN ('overrideSetting', 'databaseSetting');"; + $query = "DELETE FROM civicrm_setting WHERE name = 'overrideSetting'"; CRM_Core_DAO::executeQuery($query); } - /** - * Ensure that overrides in $civicrm_setting apply when - * using getItem($group). - */ - public function testGetItemGroup_Override() { - global $civicrm_setting; - $civicrm_setting[CRM_Core_BAO_Setting::DIRECTORY_PREFERENCES_NAME]['imageUploadDir'] = '/test/override'; - Civi::service('settings_manager')->useMandatory(); - $values = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::DIRECTORY_PREFERENCES_NAME); - $this->assertEquals('/test/override', $values['imageUploadDir']); - } - public function testDefaults() { CRM_Core_DAO::executeQuery('DELETE FROM civicrm_setting WHERE name = "max_attachments"'); Civi::service('settings_manager')->flush(); -- 2.25.1