+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
require_once 'CiviTest/CiviUnitTestCase.php';
/**
* /**
- * Check getfields works
+ * Check getfields works.
*/
public function testGetFields() {
$description = 'Demonstrate return from getfields - see subfolder for variants';
}
/**
- * Test that getfields will filter on group
+ * Test that getfields will filter on group.
*/
public function testGetFieldsGroupFilters() {
$params = array('filters' => array('group' => 'multisite'));
'description' => NULL,
'help_text' => NULL,
'on_change' => array(// list of callbacks
- array(__CLASS__, '_testOnChange_onChangeExample')
+ array(__CLASS__, '_testOnChange_onChangeExample'),
),
),
));
}
/**
- * Check getfields works
+ * Check getfields works.
*/
public function testCreateSetting() {
- $description = "shows setting a variable for a given domain - if no domain is set current is assumed";
+ $description = "Shows setting a variable for a given domain - if no domain is set current is assumed.";
$params = array(
'domain_id' => $this->_domainID2,
$result = $this->callAPIAndDocument('setting', 'create', $params, __FUNCTION__, __FILE__);
$params = array('uniq_email_per_site' => 1);
- $description = "shows setting a variable for a current domain";
+ $description = "Shows setting a variable for a current domain.";
$result = $this->callAPIAndDocument('setting', 'create', $params, __FUNCTION__, __FILE__, $description, 'CreateSettingCurrentDomain');
$this->assertArrayHasKey(CRM_Core_Config::domainID(), $result['values']);
}
/**
- * Check getfields works
+ * Check getfields works.
*/
public function testCreateInvalidSettings() {
$params = array(
}
/**
- * Check getfields works
+ * Check getfields works.
*/
public function testCreateInvalidBooleanSettings() {
$params = array(
}
/**
- * Check getfields works
+ * Check getfields works.
*/
public function testCreateSettingMultipleDomains() {
- $description = "shows setting a variable for all domains";
+ $description = "Shows setting a variable for all domains.";
$params = array(
'domain_id' => 'all',
$params = array(
'domain_id' => 'all',
- 'return' => 'uniq_email_per_site'
+ 'return' => 'uniq_email_per_site',
);
// we'll check it with a 'get'
- $description = "shows getting a variable for all domains";
- $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__, $description, 'GetAllDomains', 'Get');
+ $description = "Shows getting a variable for all domains.";
+ $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__, $description, 'GetAllDomains');
$this->assertEquals(1, $result['values'][2]['uniq_email_per_site']);
$this->assertEquals(1, $result['values'][1]['uniq_email_per_site']);
'domain_id' => array(1, 3),
'uniq_email_per_site' => 0,
);
- $description = "shows setting a variable for specified domains";
+ $description = "Shows setting a variable for specified domains.";
$result = $this->callAPIAndDocument('setting', 'create', $params, __FUNCTION__, __FILE__, $description, 'CreateSpecifiedDomains');
$this->assertEquals(0, $result['values'][3]['uniq_email_per_site']);
'domain_id' => array(1, 2),
'return' => array('uniq_email_per_site'),
);
- $description = "shows getting a variable for specified domains";
- $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__, $description, 'GetSpecifiedDomains', 'Get');
+ $description = "Shows getting a variable for specified domains.";
+ $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__, $description, 'GetSpecifiedDomains');
$this->assertEquals(1, $result['values'][2]['uniq_email_per_site']);
$this->assertEquals(0, $result['values'][1]['uniq_email_per_site']);
'domain_id' => $this->_domainID2,
'return' => 'uniq_email_per_site',
);
- $description = "shows get setting a variable for a given domain - if no domain is set current is assumed";
+ $description = "Shows get setting a variable for a given domain - if no domain is set current is assumed.";
$result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__);
$params = array(
'return' => 'uniq_email_per_site',
);
- $description = "shows getting a variable for a current domain";
+ $description = "Shows getting a variable for a current domain.";
$result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__, $description, 'GetSettingCurrentDomain');
$this->assertArrayHasKey(CRM_Core_Config::domainID(), $result['values']);
}
/**
- * Check that setting defined in extension can be retrieved
+ * Check that setting defined in extension can be retrieved.
*/
public function testGetExtensionSetting() {
$this->hookClass->setHook('civicrm_alterSettingsFolders', array($this, 'setExtensionMetadata'));
public function testGetSetConfigSettingMultipleDomains() {
$settings = $this->callAPISuccess('setting', 'create', array(
'defaultCurrency' => 'USD',
- 'domain_id' => $this->_currentDomain
+ 'domain_id' => $this->_currentDomain,
)
);
$settings = $this->callAPISuccess('setting', 'create', array(
'defaultCurrency' => 'CAD',
- 'domain_id' => $this->_domainID2
+ 'domain_id' => $this->_domainID2,
)
);
$settings = $this->callAPISuccess('setting', 'get', array(
}
/**
- * Use getValue against a config setting
+ * Use getValue against a config setting.
*/
public function testGetValueConfigSetting() {
$params = array(
public function testGetValue() {
$params = array(
'name' => 'petition_contacts',
- 'group' => 'Campaign Preferences'
+ 'group' => 'Campaign Preferences',
);
- $description = "Demonstrates getvalue action - intended for runtime use as better caching than get";
+ $description = "Demonstrates getvalue action - intended for runtime use as better caching than get.";
$result = $this->callAPIAndDocument('setting', 'getvalue', $params, __FUNCTION__, __FILE__, $description);
$this->assertEquals('Petition Contacts', $result);
}
public function testGetDefaults() {
- $description = "gets defaults setting a variable for a given domain - if no domain is set current is assumed";
+ $description = "Gets defaults setting a variable for a given domain - if no domain is set current is assumed.";
$params = array(
'name' => 'address_format',
);
- $result = $this->callAPIAndDocument('setting', 'getdefaults', $params, __FUNCTION__, __FILE__, $description, 'GetDefaults', 'getdefaults');
+ $result = $this->callAPIAndDocument('setting', 'getdefaults', $params, __FUNCTION__, __FILE__, $description, 'GetDefaults');
$this->assertEquals("{contact.address_name}\n{contact.street_address}\n{contact.supplemental_address_1}\n{contact.supplemental_address_2}\n{contact.city}{, }{contact.state_province}{ }{contact.postal_code}\n{contact.country}", $result['values'][CRM_Core_Config::domainID()]['address_format']);
$params = array('name' => 'mailing_format');
$result = $this->callAPISuccess('setting', 'getdefaults', $params);
}
/**
- * Function tests reverting a specific parameter
+ * Function tests reverting a specific parameter.
*/
public function testRevert() {
$params = array(
$result = $this->callAPISuccess('setting', 'create', $params);
$this->assertAPISuccess($result, "in line " . __LINE__);
$revertParams = array(
- 'name' => 'address_format'
+ 'name' => 'address_format',
);
$result = $this->callAPISuccess('setting', 'get', $params);
//make sure it's set
$this->assertEquals('xyz', $result['values'][CRM_Core_Config::domainID()]['address_format']);
- $description = "Demonstrates reverting a parameter to default value";
- $result = $this->callAPIAndDocument('setting', 'revert', $revertParams, __FUNCTION__, __FILE__, $description, '', 'revert');
+ $description = "Demonstrates reverting a parameter to default value.";
+ $result = $this->callAPIAndDocument('setting', 'revert', $revertParams, __FUNCTION__, __FILE__, $description, '');
//make sure it's reverted
$result = $this->callAPISuccess('setting', 'get', $params);
$this->assertEquals("{contact.address_name}\n{contact.street_address}\n{contact.supplemental_address_1}\n{contact.supplemental_address_2}\n{contact.city}{, }{contact.state_province}{ }{contact.postal_code}\n{contact.country}", $result['values'][CRM_Core_Config::domainID()]['address_format']);
}
/**
- * Tests filling missing params
+ * Tests filling missing params.
*/
public function testFill() {
$domparams = array(
$this->assertArrayHasKey('extensionsDir', $result['values'][$dom['id']]);
$this->assertEquals('Unconfirmed', $result['values'][$dom['id']]['tag_unconfirmed']);
}
+
}