From: Tim Otten Date: Sat, 12 Sep 2015 22:13:55 +0000 (-0700) Subject: api_v3_SettingTest - Fix up X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=72174371ec926db88b4a1d04adf804c7d6d177cd;p=civicrm-core.git api_v3_SettingTest - Fix up --- diff --git a/tests/phpunit/api/v3/SettingTest.php b/tests/phpunit/api/v3/SettingTest.php index c0c56c2084..2c33d18cee 100644 --- a/tests/phpunit/api/v3/SettingTest.php +++ b/tests/phpunit/api/v3/SettingTest.php @@ -110,11 +110,12 @@ class api_v3_SettingTest extends CiviUnitTestCase { */ public function testGetFieldsCaching() { $settingsMetadata = array(); - CRM_Core_BAO_Cache::setItem($settingsMetadata, 'CiviCRM setting Specs', 'settingsMetadata__'); - CRM_Core_BAO_Cache::setItem($settingsMetadata, 'CiviCRM setting Spec', 'All'); + Civi::cache('settings')->set('settingsMetadata__', $settingsMetadata); + Civi::cache('settings')->set(\Civi\Core\SettingsMetadata::ALL, $settingsMetadata); $result = $this->callAPISuccess('setting', 'getfields', array()); $this->assertArrayNotHasKey('customCSSURL', $result['values']); $this->quickCleanup(array('civicrm_cache')); + Civi::cache('settings')->flush(); } public function testGetFieldsFilters() { @@ -369,20 +370,19 @@ class api_v3_SettingTest extends CiviUnitTestCase { public function testSetConfigSetting() { $config = CRM_Core_Config::singleton(); $this->assertFalse($config->debug == 1); + $params = array( 'domain_id' => $this->_domainID2, 'debug_enabled' => 1, ); $result = $this->callAPISuccess('setting', 'create', $params); + + $this->assertEquals(1, Civi::settings($this->_domainID2)->get('debug_enabled')); + CRM_Core_BAO_Domain::setDomain($this->_domainID2); $config = CRM_Core_Config::singleton(TRUE, TRUE); CRM_Core_BAO_Domain::resetDomain(); - $this->assertTrue($config->debug == 1); - // this should NOT be stored in the settings table now - only in config - $sql = " SELECT count(*) as c FROM civicrm_setting WHERE name LIKE '%maxFileSize%'"; - $dao = CRM_Core_DAO::executeQuery($sql); - $dao->fetch(); - $this->assertEquals($dao->c, 0); + $this->assertEquals(1, $config->debug); } /** @@ -541,7 +541,10 @@ class api_v3_SettingTest extends CiviUnitTestCase { $result = $this->callAPISuccess('setting', 'get', $params); $this->assertAPISuccess($result, "in line " . __LINE__); $this->assertArrayHasKey('tag_unconfirmed', $result['values'][$dom['id']]); - $this->assertArrayHasKey('extensionsDir', $result['values'][$dom['id']]); + + // Setting has NULL default. Not returned. + //$this->assertArrayHasKey('extensionsDir', $result['values'][$dom['id']]); + $this->assertEquals('Unconfirmed', $result['values'][$dom['id']]['tag_unconfirmed']); }