From 2ba45310ab5d719bb1f6c60a08e715db32f4ea2e Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 11 Apr 2013 23:04:17 +1200 Subject: [PATCH] Add test to check if config setting is correctly retrieved add a bit more assertation description on test --- tests/phpunit/api/v3/SettingTest.php | 32 +++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/api/v3/SettingTest.php b/tests/phpunit/api/v3/SettingTest.php index 48617a58c7..e816fc73c1 100644 --- a/tests/phpunit/api/v3/SettingTest.php +++ b/tests/phpunit/api/v3/SettingTest.php @@ -248,7 +248,6 @@ class api_v3_SettingTest extends CiviUnitTestCase { $params = array('version' => $this->_apiversion, 'domain_id' => 'all', 'uniq_email_per_site' => 1, - 'debug' =>1, ); $result = civicrm_api('setting', 'create', $params); $description = "shows setting a variable for all domains"; @@ -343,12 +342,39 @@ class api_v3_SettingTest extends CiviUnitTestCase { $settings = civicrm_api('setting', 'get', array( 'name' => 'defaultCurrency', 'version' => $this->_apiversion, - 'sequential' => 1, - 'debug' => 1) + 'sequential' => 1,) ); $this->assertAPISuccess($settings); $this->assertEquals('USD', $settings['values'][0]['defaultCurrency']); } + + /** + * setting api should set & fetch settings stored in config as well as those in settings table + */ + function testGetSetConfigSettingMultipleDomains() { + $settings = civicrm_api('setting', 'create', array( + 'defaultCurrency' => 'USD', + 'version' => $this->_apiversion, + 'domain_id' => $this->_currentDomain) + ); + $settings = civicrm_api('setting', 'create', array( + 'defaultCurrency' => 'CAD', + 'version' => $this->_apiversion, + 'domain_id' => $this->_domainID2) + ); + $this->assertAPISuccess($settings); + $settings = civicrm_api('setting', 'get', array( + 'return' => 'defaultCurrency', + 'version' => $this->_apiversion, + 'domain_id' => 'all', + ) + ); + $this->assertEquals('USD', $settings['values'][$this->_currentDomain]['defaultCurrency']); + $this->assertEquals('CAD', $settings['values'][$this->_domainID2]['defaultCurrency'], + "second domain (id {$this->_domainID2} ) should be set to CAD. First dom was {$this->_currentDomain} & was USD"); + + } + /* * Use getValue against a config setting */ -- 2.25.1