Commit 2ba45310 authored by eileen's avatar eileen

Add test to check if config setting is correctly retrieved

add a bit more assertation description on test
parent a14b710a
......@@ -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
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment